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

Autoconfigurator by code sample #543

Closed
qfox opened this issue Jul 27, 2014 · 3 comments
Closed

Autoconfigurator by code sample #543

qfox opened this issue Jul 27, 2014 · 3 comments

Comments

@qfox
Copy link
Member

qfox commented Jul 27, 2014

Seems like we are ready to have some tasty tool to generate jscs configs for different projects by samples.

I see that we can group rules by it's application and then just fill complete matrix with 0s and 1s to each rule sets. On each step we just enable 1 rule of each group, test code sample, and if there is no error then set 1 to that rule. If there is an error then set -1 (or 0). Finally when all test cases will be done we just select right rule of each group with right value.

Some complex rules with non-boolean values can be just ignored and specified manually later. But also it can be calculated by special callbacks (e.g. tabs or spaces?).

What you think?

@mrjoelkemp
Copy link
Member

+1 Love the idea. The proposed implementation sounds like it could work; although, it assumes that a sample is representative enough of the entire codebase to properly assume the rules to set.

Perhaps this could be extended to an entire codebase where we spawn forks to gather the proposed configs on a per-file basis then the master process could determine the rules to set by the majority. e.g., if 90% of the modules agree on a particular rule's configuration, then that's the configuration to use.

This would make a nice generator tool outside of the jscs codebase. That tool could get access to the jscs ruleset by requiring it as a dependency and looking into node_modules/jscs/lib/rules. Not too pretty, but it works. Unless, there's a way to require('jscs') and then get access to the _activeRules.

@qfox
Copy link
Member Author

qfox commented Jul 27, 2014

👍 Yup. Btw jscs can provide some method to get some lib or even get registered rule. Similar to registerRule in #482

@qfox qfox mentioned this issue Jul 27, 2014
@markelog
Copy link
Member

See #341

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

No branches or pull requests

3 participants