Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Configuration: design review #672

Closed
wants to merge 50 commits into from
Closed

Conversation

mdevils
Copy link
Member

@mdevils mdevils commented Oct 7, 2014

Plugin support with a bunch of configuration simplification.

I suggest to simplify configuration routines to a pair of files:

  • Configuration — base configuration class. Works in any environment, used by StringChecker.
  • NodeConfiguration (temporal name) — node.js-specific configuration class. Works in node.js.

This replaces all configuration code in Checker, StringChecker, files at lib/options. Can replace routines at CLI-module during further development.

Still we can keep full backward compatibility. This is just an internal redesign.

/cc @markelog, @mikesherov, @mrjoelkemp

@mdevils mdevils force-pushed the mdevils.plugins branch 3 times, most recently from ccad22d to c7682bb Compare October 7, 2014 20:12
* Registers built-in Code Style cheking rules.
*/
Configuration.prototype.registerDefaultRules = function() {
this.registerRule(new (require('./../rules/require-curly-braces'))());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you leave a comment here explaining why we need to explicitly enumerate each rule. I know it's for browserify, but would be good to have that noted in the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, was thinking about it, thank you!

@mikesherov
Copy link
Contributor

Would love to see how this gets used in Checker and StringChecker. Seeing an implementation would help me review. Looks great so far.

@mrjoelkemp
Copy link
Member

I like it too. Having this configuration logic in a single place makes the flow clearer. +1 for the plugin hooks. Great job.

@mdevils
Copy link
Member Author

mdevils commented Oct 13, 2014

Integrated into StringChecker/Checker, going to publish tomorrow, some fixes are still required. No compatibility broken yet.

@mdevils
Copy link
Member Author

mdevils commented Oct 14, 2014

Published version with StringChecker / Checker integration. Check it out please. If you find it OK, I will remake CLI configuration (going to simplify it using the same classes).

this._fileExtensions = this._configuration.getFileExtensions();

this._excludes = this._configuration.getExcludedFiles().map(function(pattern) {
return new minimatch.Minimatch(path.resolve(cwd, pattern), {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should exist inside the configuration module

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

@mdevils mdevils force-pushed the mdevils.plugins branch 2 times, most recently from 4bf82c0 to 0f2a630 Compare October 14, 2014 20:42
Florian Fesseler and others added 9 commits October 15, 2014 10:42
In max-errors.js, Object.defineProperties cast the config maxErrors property to Number
but not the StringChecker maxErrors property.

This leads to a bug if multiple jscs checks are executed using the same config object
(config.maxerrors will equal 'undefined' the first time, and 'NaN' the second time)
When a switch case only uses returns instead of breaks, treat the return indentation as the break indentation.

Closes gh-686
Fixes #684
These options were surrounded by single quotes instead of
backticks, so they were not formatted as code like the
other options.

Closes gh-683
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.48%) when pulling 0d6d62f on mdevils.plugins into c70fec7 on mdevils.camel-case.

hzoo and others added 5 commits October 26, 2014 23:29
When there are multiple spaces between parameters, throw an error
until it matches the specified seperator value.

Fixes #701
Closes #707
Documentation, spaces, code style issues and add tests for "true" value

Closes #586
@mdevils
Copy link
Member Author

mdevils commented Oct 28, 2014

What I have done:

  • Finished Configuration tests.

Next steps:

  • Write NodeConfiguration tests.
  • Rebase and implement esnext and esprima options.
  • Port the error about non-camelcase options.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.27%) when pulling 2e9fafa on mdevils.plugins into c70fec7 on mdevils.camel-case.

@mdevils
Copy link
Member Author

mdevils commented Oct 28, 2014

What I have done:

  • Finished NodeConfiguration tests.

Next steps:

  • Rebase and implement esnext and esprima options.
  • Port the error about non-camelcase options.

I'm almost there! 😄

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) when pulling 7891e18 on mdevils.plugins into c70fec7 on mdevils.camel-case.

@mdevils
Copy link
Member Author

mdevils commented Oct 30, 2014

What I have done:

  • Ported the error about non-camelcase options.

Next step:

  • Rebase and implement esnext and esprima options.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.14%) when pulling ea29ea5 on mdevils.plugins into c70fec7 on mdevils.camel-case.

@mdevils
Copy link
Member Author

mdevils commented Oct 30, 2014

Finished my work. Check it out: #731

@coveralls
Copy link

Coverage Status

Coverage decreased (-5.4%) to 86.943% when pulling 5e8e4c8 on mdevils.plugins into c70fec7 on mdevils.camel-case.

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

Successfully merging this pull request may close these issues.