linterhub / usage-parser Goto Github PK
View Code? Open in Web Editor NEWUsage parser
Home Page: https://github.com/linterhub/usage-parser
License: MIT License
Usage parser
Home Page: https://github.com/linterhub/usage-parser
License: MIT License
It's unclear why script is failing during execution. Please, add handling of errors.
Project have many linting errors. Please, fix it.
Please, create next implementation of templatizer function:
Please add support for .pullapprove.yml
and make @linterhub/maintainers as reviewers for this repo.
If parser running many times in cycle, result json file consist arguments of all previous iterations. Please, fix it.
Please, create templates:
Please, add validation of configuration, which should have:
Sometimes, in options section it is no information what can be interpreted that option is not flag. But, in examples there is so.
Example:
Options:
--plugin Include third-party plugins [Can be set multiple times]
Examples:
$ xo --plugin=html --extension=html
Please, add parsing of "args" prefix by examples.
Please, add functionality for identifying of prefix "args" for non-flag arguments.
Please, add a template for an issue and pull request, also add labels for repository
Recommendation:
Please, find solution of parsing argument types (string, number, etc.) in templatizer function
Default value is not assigning to options now. Please, fix it.
Now, after parsing an argument, default value in it description isn't deleted. Please, make so, that default value will be deleted from description.
Please, create an implementation for splitSection function. This function should slice a section into array of options. Every element of array is string (option with description).
Please, create parsing of all arguments, which should be with linterhub prefix in templatizer function.
Please, add travis configuration.
Config must be include following command:
npm run test
Now, in parser using only one pattern of default value of argument:
/\[default:
(.*?)]/
So, default value will be parsed only if it looks like [default: 70]
.
Please, add other patterns.
I find next errors:
Please, fix it.
Please, do refactoring of tests, because parts of code in test/config/test.js, test/sections/test.js, test/result/test.js are the same.
Also, please, do refactoring of tests filenames (folder files #52).
Next solutions isn't good:
const context = require('./template/context.js');
context.options = [];
const argumentsTemplate = JSON.parse(fs.readFileSync('./src/template/args.json'));
argumentsTemplate.definitions.arguments.properties = {};
It it necessary, because javascript filling empty templates, and for each next iteration of parser, js using this filled templates. Please, find best solution, how to fix it
Please, create implementation for parseSection function, which should get a section with some title from usage. For example, a section with title "Options:".
Sections are not parsing, if:
Options:
-h, --help output usage information
-V, --version output the version number
Examples:
htmlhint
Please, fix it.
Now, users are not able to configure prefixes of arguments (linterhub:, args:). Please, make it configurable.
Please, add tests for two or more sections of one type (two "options:", three "examples", etc.).
Please, add new property "parseWhole" [boolean] to configuration.
If it true and no sections with names and postfixes was found, the whole file will be parsed. Each part, which starts at new line and begin with "-" will be parsed as option, and part between option and next option will be parsed as option description.
If description of option have two spaces between words or parts, will be parsed only first part before two spaces. Please, fix it.
Also, when description multiline, each line concatenates with previous without spaces.
Also, when description multiline, argument name becomes "null".
If option have only short name, it id in result json will be "null". Please, fix it.
Please, add parsing of delimiter between arguments and values (for non-flag args).
Please, add packages tests (one valid and one failing) with gulp. Tests should be:
Please, add tests for configValidation function:
Please, add inital docs:
package.json
gitignore
README.md
- with structurePlease, add linting to project for js files.
Please, add tests of sections (with help of chai) what are using in parser.
Tests:
Function splitSection of handle.js looks unclear, it's hard to undestand it logic. Please, do refactoring.
In result json file, linterhub:path argument description is null. Please, fix it.
Now, all configuration of parsing is in handle.js file. It is better to move configuration to a separate file.
We have next config:
Please, create base implementation of parser function:
Please, create implementation for handle function. This function should:
Undefined option adds to result, if no linterhub:path required (in usage "file" or "path" is not found). Please, fix it
Please, create implementation for parseOption function, which should slice an option with description into array and return it. This array will be write into json later.
Structure of array:
We have new algorithm of parsing (#38). Please, add tests for it.
Now, delimiter from config is not in use. Please, add it using.
Convert the information about the commands, options and flags of console app to JSON Object. This information is usually available when executing help
command (possible synonyms: -h
, --help
, ?
, etc.).
Example from docopt project:
Naval Fate.
Usage:
naval_fate ship new <name>...
naval_fate ship <name> move <x> <y> [--speed=<kn>]
naval_fate ship shoot <x> <y>
naval_fate mine (set|remove) <x> <y> [--moored|--drifting]
naval_fate -h | --help
naval_fate --version
Options:
-h --help Show this screen.
--version Show version.
--speed=<kn> Speed in knots [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.
So, this information could be parsed and converted to JSON similar to args definition. It should describe available arguments/commands/flags, name, type (if possible), default value and so on. There is no need to create exactly the same structure, args mentioned just as an example.
Implementation should include:
usage
information and return JSON object according to schema;Some examples for args schema are here.
When constructing JSON Object give attention to next recommendation:
--help
, not -h
Default value of option option is undefined when it is no defaults for it. Please, fix it, because it makes testing of parsing harder.
User should be able to send config and help (which will be parsed) as:
Please, add this features to index.js.
Please, add tests of result of parser. Tests have input string & output json and should compare result of parsing input string with output json, what should be.
I've found next errors:
Now, it is parsing only one section name. But, some linters have "Options" instead of "Options:", or custom names: "Basic configuration:" (example from eslint).
Please, change algorithm of parsing of required sections (now it is only section "Options:") to the same way:
Please, fix 2 problems:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.