Ignore Irrelevant Code
Last updated
Last updated
SeaLights' Code Scope empowers you to tailor your quality analysis. Define inclusion and exclusion rules to analyze specific code areas, prioritizing relevant sections and streamlining testing (e.g., excluding legacy code you are not interested in getting coverage for). By default, the entire app's code is included. There are three ways to set Code Scope: app level, file level and method level.
Each application has a built-in "Global Code Entities Rule" that intelligently excludes certain method-level elements based on the app's programming language. This typically includes:
Auto-Generated Code: Eliminate noise from code that isn't manually written.
Getters and Setters: Focus on core logic instead of routine property access.
Constructors: Simplify analysis by excluding default object creation methods.
Deprecated Code: Avoid analyzing outdated and potentially unsafe sections.
Anonymous Methods: Streamline analysis by excluding methods defined directly within blocks of code.
By fine-tuning this global rule, you establish a solid foundation for focused and efficient analysis, ensuring that your efforts are directed toward the most impactful areas of your codebase.
SeaLights' Code Scope offers granular control at the file level. This enables you to find a sweet spot between accuracy and maintenance, tailoring your analysis to focus on critical sections while keeping management manageable. Rule types:
Include: Focuses analysis on specific code areas. Ideal for analyzing smaller scopes or excluding irrelevant sections. For example, If you want to analyze the coverage for API tests, create an "Include" rule for this particular test stage that targets only the files relevant for those APIs.
Ignore: Removes specific code from analysis, streamlining your focus. For example, excluding legacy code you are not interested in getting coverage for.
Rule Conflicts:
Please note that when defining both "Include" and "Ignore" rules for the same code scope, the "Ignore" rule will take precedence. This ensures you have clear control over what gets excluded from your analysis.
Newly added files within a scoped folder automatically adhere to the defined rules, ensuring your analysis stays up-to-date. No need to manually update every time your codebase changes!
SeaLights' Code Scope offers fine-grained method-level exclusions directly within the Test Gaps Analysis report. You can pinpoint individual methods, mark them for exclusion as needed and focus your analysis on truly relevant code.
Excluded methods automatically become "Ignore" rules in the Code Scope settings, ensuring your analysis adapts effortlessly as your codebase evolves.
Note! Excluded methods remain visible in the report but are marked as ignored for clarity.
Keep in mind! Code Scope rules take effect from the next reported build in SeaLights.
By defining Code Scope, you can tailor the analysis to specific code areas, gain valuable insights into software quality, and focus on improving the most critical sections of your codebase.