Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do Code Climate analysis again #11

Closed
eddyystop opened this issue Oct 17, 2016 · 7 comments
Closed

Do Code Climate analysis again #11

eddyystop opened this issue Oct 17, 2016 · 7 comments

Comments

@eddyystop
Copy link
Collaborator

Code Climate complains about duplicate code even if its in different modules. I found that did not work well for me with unit tests as I want each test to be as obvious as possible. I'll look into how to ignore test files.

@eddyystop
Copy link
Collaborator Author

@ekryski say:
@eddyystop you can add a codeclimate.yml file to exclude paths. https://docs.codeclimate.com/docs/excluding-files-and-folders

Tightening up some of rules it uses is on my radar for the other repos as well. Definitely not a huge priority though given most of the repos have a 4.0 GPA.

@daffl
Copy link
Member

daffl commented Oct 17, 2016

The repositories we set up so far (like https://github.com/feathersjs/feathers-permissions) don't seem to include the test files in Code Climate. Maybe because the config at https://github.com/feathersjs/feathers-permissions/blob/master/.istanbul.yml sets the root?

@daffl
Copy link
Member

daffl commented Oct 18, 2016

Oh nevermind, I see it in some of the other repos, too. Let's look into if we can ignore the test/ folder in Code Climate. I totally agree, tests are one of the few places where it is totally fine to repeat yourself.

@ekryski
Copy link
Member

ekryski commented Oct 18, 2016

We might be able to even just ignore certain rules

@eddyystop
Copy link
Collaborator Author

eddyystop commented Oct 18, 2016

Here's info I rec'd earlier this year. I had stopped using CC by then because of their tardy support.

Jenna Smith [email protected]
to me
Hey there-

It was buried at the bottom, so not sure if you saw it in my previous
email, but you do have the option to exclude files/folders on a per-engine
basis. For example, if you just wanted to exclude a certain directory from
our duplication analysis, you can do that as well. That would look
something like this:

I realize now that I probably should have put that above the information
about the global excludes so that you could see it better. Sorry about that!

Does that answer your questions? Or is there anything else I can do to help?

Other links:

In case it's helpful, here's a doc that explains all of this in further
detail: https://docs.codeclimate.com/docs/excluding-files-and-folders.

And here's the section that talks about excluding on a per engine basis:
https://docs.codeclimate.com/docs/excluding-files-and-
folders#section-exclude-paths-for-specific-engines.

Here are the analysis CC can run:
https://docs.codeclimate.com/docs/list-of-engines

@eddyystop
Copy link
Collaborator Author

image

@eddyystop
Copy link
Collaborator Author

eddyystop commented Oct 18, 2016

The analysis of feathers-hooks-common is here.

Do you want me to make the repetative code on different modules DRY? I think that would worsen its quality.

One alternative is to have CC ignore these particular dups. However you can't tell what is being excluded because its a hash. You can't reasonably include the dup code as comments to doc the hash because it could be 20 lines long. So we would end up with

engines:
  duplication:
    enabled: true
    # need this: Config Error: Unable to run the duplication engine without any languages enabled.
    config:
      languages:
      - javascript
    exclude_paths:
    - "test/"
    exclude_fingerprints:
    - 5fe47a6f2c4df971a1b6f3958c9b3cd4
    - e6fb8d617273153252180f7a10a24ac6
    - 1a0b806990ced9ec7ba1e55749b18197
    - 0323a4bda01997a1319c35acadcd8c4b
    - 0b9a2fee69d7da77202b1cc0c801a1f4

The other alternative is to disable the check but I think CC gives us mainly (only?) dup checking since eslint'ing is already part of Travis. So besides a badge, what would CC do for us if we disabled the check?

It seems like some repos will end up pasting hashes to get the badge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants