Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Autofix setting in config file is not working #2. The issue is that the "autofix" command line flag was overriding the Config object. So even if the config had autofix: true, later in the main function the flag value would override this configuration. It didn't help that the default bool value for the flag was 'false'.
Refactor the main code at linelint.go, allowing for input from STDIN. This took some inspiration from autopep8, in which to read from STDIN requires the "-" positional argument (any other positional argument is interpreted as a list of files/dirs to lint, and an "empty" list is interpreted as "lint the current directory tree"). This also makes it much easier to test the linting from the main entrypoint.
Add a couple tests as Example in linelint_test.go, using the new "read from stdin" functionality.
Also refactor the config package to make the newDefaultConfig method public, this way methods (and tests, specially the Example above) can use it to create a "default" config without depending on external file. Also expose the implicit dependency on a file path for the NewConfig method, renaming it to
NewConfigFromFile
and taking a file path as a parameter.