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

Configuration schema is not valid when using array format to specify rules #1025

Closed
kshyju opened this issue Apr 25, 2018 · 2 comments · Fixed by #1053
Closed

Configuration schema is not valid when using array format to specify rules #1025

kshyju opened this issue Apr 25, 2018 · 2 comments · Fixed by #1053

Comments

@kshyju
Copy link
Member

kshyju commented Apr 25, 2018

As per the documentation, we can configure rules as an array like this

{
    "rules": [
        "rule1:warning"
    ]
}

But this does not work! When running sonarwhal, i get an error saying the config schema is not valid

Shyjus-MacBook-Pro:sonarwhal shyju$ yarn sonarwhal https://news.ycombinator.com -f summary
yarn run v1.6.0
$ node dist/src/bin/sonarwhal https://news.ycombinator.com -f summary
Configuration schema is not valid
Error: Couldn't find any valid configuration
    at Function.fromConfig (/Users/shyju/Documents/Dev/GitHub/sonarwhal/packages/sonarwhal/dist/src/lib/config.js:188:19)
    at exports.analyze (/Users/shyju/Documents/Dev/GitHub/sonarwhal/packages/sonarwhal/dist/src/lib/cli/analyze.js:123:45)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
    at Function.Module.runMain (module.js:692:11)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:666:3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Shyjus-MacBook-Pro:sonarwhal shyju$


I tried switching the type from object to array in the config-schema.json file, but that did not help!

Environment

  • sonarwhal version: v1.7.0
  • Node.js version: v9.10.1
  • __npm version:__5.8.0

My sonarwhal config

{
    "connector": {
        "name": "chrome",
        "options": {
            "waitFor": 1000
        }
    },
    "formatters": ["summary"],
    "parsers": [],
    "rulesTimeout": 120000,
    "rules": [
        "amp-validator:warning",
        "sri:warning"
    ]
}

This also does not work

"rules": [
    "?amp-validator",
    "?sri"
]
@alrra
Copy link
Contributor

alrra commented Apr 25, 2018

Configuration schema is not valid

config-schema needs to be updated.


Another questions related to this: Do we want to still support the shorthands? I haven't seen anyone using them.

@molant
Copy link
Member

molant commented Apr 25, 2018

Do we want to still support the shorthands?

For @kshyju work on #1029 it would have been handy. Also we haven't promote them a lot so that could be the reason.

I personally like the shorthand version amp-validator:warning. I think we should try to fix the scenario, maybe adding a "preprocessor" right after reading the JSON file that converts it to the standard format? This way we don't have to complicate the config-schema.

@sarvaje sarvaje self-assigned this May 10, 2018
sarvaje added a commit to sarvaje/hint that referenced this issue May 11, 2018
molant pushed a commit that referenced this issue May 11, 2018
alrra pushed a commit that referenced this issue May 15, 2018
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.

4 participants