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

Rules definition #41

Closed
wants to merge 11 commits into from
Closed

Rules definition #41

wants to merge 11 commits into from

Conversation

catenacyber
Copy link
Owner

For #39

@alexandear @mmorel-35 @ccoVeille

What do you think of this ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to write tests to ensure we don't break anything with all these new options?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I agree.

What is the best way ?

Have analysistest.RunWithSuggestedFixes(t, analysistest.TestData(), a, "somedir") for all 10 options with a different value than the default one ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

The tests caught an error with fmt.Errorf("toto") becoming just a string when disabling error-format ;-)

Copy link
Contributor

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

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

I'm less present lately for personal reasons.

I might reply with delay if you have questions, but here are my remarks.

And I agree with @alexandear tests are needed

analyzer/analyzer.go Show resolved Hide resolved
analyzer/analyzer.go Outdated Show resolved Hide resolved
analyzer/analyzer.go Outdated Show resolved Hide resolved
analyzer/analyzer.go Outdated Show resolved Hide resolved
analyzer/analyzer.go Outdated Show resolved Hide resolved
analyzer/analyzer.go Outdated Show resolved Hide resolved
analyzer/analyzer.go Outdated Show resolved Hide resolved
analyzer/analyzer.go Outdated Show resolved Hide resolved
As consistency between options is done at init time
and invert the negation in consequences
r.Flags.BoolVar(&n.fiximports, "fiximports", true, "fix needed imports from other fixes")
r.Flags.BoolVar(&n.strconcat, "strconcat", true, "optimizes into strings concatenation")

Copy link
Contributor

Choose a reason for hiding this comment

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

You should not need all of that. Your algorithm shall start by checking if a format is activated and then trigger check their option.
Let's try to follow KISS principle here

Copy link
Owner Author

Choose a reason for hiding this comment

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

But some default options being true, I still need to do the check

@catenacyber
Copy link
Owner Author

I pushed a new version in #42

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

Successfully merging this pull request may close these issues.

4 participants