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

Support for paths to resources on .sonarwhalrc #1123

Closed
sarvaje opened this issue Jun 7, 2018 · 2 comments
Closed

Support for paths to resources on .sonarwhalrc #1123

sarvaje opened this issue Jun 7, 2018 · 2 comments

Comments

@sarvaje
Copy link
Contributor

sarvaje commented Jun 7, 2018

Original issue at the end.

On top of using package names, we should allow paths.

The scenarios that this unlocks are:

  • Shared configurations in the same project There are some rules that apply to all moments of the development process, but some others that are only valid when the site is in staging or in production. For example: I could test my website locally, but I'm probably not going to compress my assets using brotli all the time. This way we can have a common file that we can extend from and have those configurations as part of the project:
{
  "extends": "./common/.sonarwhalrc",
  "connector": "local"
}
  • Custom resources for the project Having to create a package for a custom rule/parser is some overhead that not everybody is willing to do (and TBH, not worth it if it is very specific). This way there's no need to publish a package to create it (we might want to improve the wizard and just create a single file with no testing files for this scenario?):
{
  ...
  "rules": {
    "./rules/my-custom-rule.js": "error"
  }
}

Steps to reproduce:

  1. Go to rule-no-vulnerable-javascript-libraries
  2. Run npm install
  3. Run npm test
@sarvaje
Copy link
Contributor Author

sarvaje commented Jun 7, 2018

I've been talking with @molant and the idea is support not only id for resources, but also paths. This should avoid this problem and allow more flexibility to the configuration.

sarvaje added a commit to sarvaje/hint that referenced this issue Jun 7, 2018
@molant molant changed the title Test doesn't work using npm Support for paths to resources on .sonarwhalrc Jun 13, 2018
@molant molant self-assigned this Jun 13, 2018
@alrra
Copy link
Contributor

alrra commented Jun 21, 2018

Done in 1e2e54f.

@alrra alrra closed this as completed Jun 21, 2018
alrra pushed a commit that referenced this issue Jul 3, 2018
Enable loading a resource using a path instead of the ID of the package.
This is useful when you have multiple configuration files with some
common parts or when you have a locally developed rule that you don't
want to publish on a package.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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

Successfully merging a pull request may close this issue.

3 participants