-
Working with Pull Requests
Every time you open a new Pull Request (PR) CodeFactor inspects it and reports results on dedicated PR page and on GitHub/Bitbucket as commit status.
If you're using GitHub, you can now setup detailed reporting inside PR via Checks feature. To begin, visit the Settings page for your repository.
CodeFactor shows issues for any files that were added or modified between the source and target branches. When the target branch changes over time and merge commit is made for PR, CodeFactor tries to exclude any unrelated issues to reduce noise. You may still see unrelated issues for cases when PR is created
-
Working with Python code files
CodeFactor supports Python 2.7.x and 3.13.x as there are key differences between them. Version 3.13.x is enabled by default, but you can change this on repository Settings page:
Once new version is selected, all related Python files for actives branches will be reinspected.
-
Ignoring issues and patterns
If you would like to ignore a specific Issue or entire issue pattern across repository, you can have CodeFactor.io ignore it as follows:
- Go to any page containing issues.
- Click Ignore icon (shown as eye) on upper right corner of issue header.
- Click Ignore Issue to exclude selected issue only.
- Click Ignore Issues like this to exclude selected issue pattern for entire repository.
- Click Ignore File to exclude related file with all it's issues.
If you later decide that some issues should no longer be ignored, go to Issues page and click Ignored filter button on upper right corner. Here you
-
Ignoring code files
If you see that a specific file should not be included for inspection you can ignore it:
- Go to code file page.
- Click Ignore this file button on upper right.
If you have a folder or a global file pattern that should not be included you can ignore it as well:
- Go to repository Settings
- Click Ignore Files.
- Enter patterns and click Save changes.
Note: Case sensitive patterns, one per line. (e.g. src/blob/* to exclude all files in blob folder).
Note: some files are ignored automatically. E.g. files created by Visual Studio designer or containing auto-generated marker.
-
Working with duplication issues
With Duplication checker enabled, CodeFactor finds similar or duplicate source code for all supported languages. Statistics shows that this checker slows down analysis and reports on issues that are usually non-actionable or just entirely ignored by users. For those reasons and to keep non-actionable reports to a minimum it's disabled by default.
If you still would like to see duplication results for your repository, you may enable it in repository Settings page on CodeFactor.
.
If you decide to use duplication checker note that:
- There is an inspection timeout window set for each language. If analysis exceeds this window,
-
Setting default branch
The default branch is considered the "base" branch in your repository, against which all pull requests and code commits are made.
CodeFactor will try to identify default branch when importing new repository. If you have admin rights over a repository, you can set new default branch:
- Go to repository Settings
- Change the default branch using the dropdown.
-
Toggling active branches
By default CodeFactor will inspect default branch only for new repositories. However, you can freely enable other branches as well:
- Go to repository Branches
- Click On/Off toggle to start or stop code quality inspection.
-
Using branch Badges
CodeFactor is very excited to support branch badges that developers can integrate into their repositories on GitHub and Bitbucket. Make code quality visible!
Here is How
Go to any repository page and click badge icon to see available options:
The dialog contains links that are related to currently selected branch:
Feel free to choose from available styles by adding style=<name> parameter:
- https://www.codefactor.io/repository/github/codefactor-io/default-configs/badge?style=plastic
- https://www.codefactor.io/repository/github/codefactor-io/default-configs/badge?style=flat-square
- https://www.codefactor.io/repository/github/codefactor-io/default-configs/badge?style=for-the-badge
- https://www.codefactor.io/repository/github/codefactor-io/default-configs/badge?style=social
-
Using GitHub Checks
By default, CodeFactor updates Pull Request's status during review. E.g.:
To view any reported issues you must click Details link and visit CodeFactor page with review results.
A more integrated approach would be to report issues as code comments inside pull request and this is what GitHub Checks feature is for. To enable it go to repository Settings page and click Enable under GitHub App panel:
If you'd like to revert back to status-only reviews, click Update under GitHub App panel or visit App install page on GitHub to perform uninstall.
-
Auto-Fix
CodeFactor can fix certain reported issues. This can be done on-demand or automatically. We currently support:
- Detekt
- ESLint
- PHP_CodeSniffer
- Linter for Dart
- Stylelint (please note of limitation when using unscoped disable comments, i.e. /* stylelint-disable */. For such files the entirety of source will not be auto-fixed.)
- TSLint
- RuboCop
- SwiftLint
On-demand fixes
When visiting a page with fixable issues, you can create new PR or commit manually:
If you do not see this button it means CodeFactor did not find any issues that can be fixed.
We recommend using it to test this