Code smell differences

Hi Guys,

I have a hard time understanding how code smell analysis works?

Currently seen on a React app in Azure DevOps pipelines.

When having a Pull request going to the Master branch I see code smells reported about files that should be renamed to match the “export default something” statement in the file itself. This code smell is of course easy fixable, but I would like that code smell to be reported already when making a Pull request to our Develop branch.

To test this, I created a new branch, and added new files, and intentionally added the above mentioned code smell. I also added other code smells like imports not being used etc.

My problem is, why does the code smell about renaming the file to the same name as being default exported in the file, not being shown as a code smell on my Pull request to Develop? The other code smells I did intentionally was flagged (as expected) as code smells on my Pull request to Develop.

So in short, I get different code smells on pull requests to develop, than I get when doing a pull request to master. Can that be fixed to be the same? I would really like to fix the code smells as early as possible.


Welcome to the community!

Analyzers are executed on the files configured as source code or test code, and generate issues that they find, depending on the rules configured in the quality profile per language. In pull requests, a subset of all issues will be visible: only issues on lines that changed in the pull request’s branch, relative to the base branch of the pull request.

The first thing I would look at is if the changed code is correctly visible on the Code tab of the pull request to Develop, highlighted with yellowish background. This indicates that the code was detected as changed in the pull request. The troubleshooting can continue in different direction, depending on what you see here.

It would be great to see this reproducer! Can you create in a public project to share?

The issue reporting doesn’t depend on the target branch. The same mechanism is applied whether the target branch is Master or Develop. So what you describe should not be possible. So I’m curious where the investigation will go, depending on your answers to the questions above.