← All posts

Release: Granular analysis on diffs

On changeset analysis, we now raise issues only on the changed lines, not files.

Header image
By Jai on 
Share on Twitter Share on LinkedIn Share on Facebook

If you’ve configured DeepSource for a GitHub repository, on each pull request, analysis is triggered on added and modified files of the changeset. For instance, in this pull request, issues are raised against masonite/request.py and masonite/response.py, not just on newly introduced lines. Take a look at the run here.

We went ahead with the approach to abide by the Boy scout rule.

Boy scout rule: Always leave the campground cleaner than you found it.

The campground here, used to be all touched files — that way, developers are encouraged to fix all issues in the file even if a single line of change is made; eventually leading to a healthier code base. We asked our users about this approach and they thought otherwise. Reason being, the changes in the pull requests started becoming out of context. Best practice of pull requests (or) change lists is to keep the change exactly within the context of the feature / fix and nothing beyond it.

We’ve rolled out this improvement as part of our recent release. From now, on pull requests issues will be reported only on newly added (or) modified lines and newly introduced issues on the file due to changed lines. The boy scout rule still applies but the playground is scoped to the line, not the file.

GitHub pull request GitHub / Pull request changes

For instance, in the pull request shown above, only line 65 is changed. Thus, the DeepSource check will report only the following issues:

  • issue on line 65
  • any newly introduced issues on the file caused by the change in line 65

DeepSource run DeepSource / History / Run

Squash the issues sticking to the context. Cheers!

About DeepSource
DeepSource helps you automatically find and fix issues in your code during code reviews, such as bug risks, anti-patterns, performance issues, and security flaws. It takes less than 5 minutes to set up with your Bitbucket, GitHub, or GitLab account. It works for Python, Go, Ruby, and JavaScript.
Get started for free

Keep reading...