Skip to content

Conversation

@volodya-lombrozo
Copy link
Collaborator

In this PR I just refactor recent changes. I combine Aibolit with SanitizedAibolit and slightly simplify critic usage.

Related to #2

@volodya-lombrozo volodya-lombrozo force-pushed the 2-refrax-aibolit-integration branch from 21b9a2f to 1d39622 Compare July 5, 2025 09:47
@volodya-lombrozo volodya-lombrozo force-pushed the 2-refrax-aibolit-integration branch from 1d39622 to 51737bc Compare July 5, 2025 09:48
@volodya-lombrozo
Copy link
Collaborator Author

@h1alexbel Could you review these changes, please?

Copy link
Contributor

@h1alexbel h1alexbel left a comment

Choose a reason for hiding this comment

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

@volodya-lombrozo please check my comments

cmd/root.go Outdated
// Currently, we create Aibolit, but it would be great to have such option. Examples of such tools
// are: `aibolit`, `none`, etc. We should be able to pass multiple tools, for instance:
// `--tools=aibolit,qulice`.
// Currently, we create Aibolit, but it would be great to have such option. Examples of such tools
Copy link
Contributor

Choose a reason for hiding this comment

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

@volodya-lombrozo do we need extra tabs here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@h1alexbel It's auto-formatting (golangci-lint fmt), but I agree, that it is out of the scope here.

// print it. Since there is no `PrintStats` method in original `Brain`, it looks ugly when we call this
// function on `Brain` instance in `refrax_client.go`. We should organize more proper abstraction
// around the aggregation and printing of stats.
// Currently, we needed it in order to aggregate all the messages in the `stats` map, and then
Copy link
Contributor

Choose a reason for hiding this comment

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

@volodya-lombrozo do we need extra tabs here?

)
aibolit := NewAibolit("Foo.java")
aibolit.executor = &mockRunner{output: strings.Join(lines, "\n")}

Copy link
Contributor

Choose a reason for hiding this comment

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

@volodya-lombrozo can we remove empty lines in the method body. Check An Empty Line is a Code Smell

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@h1alexbel I would agree with you if it was production code (no tests), but in tests it is an AAA pattern. Check this out: https://stackoverflow.com/a/24070436/10423604

It helps to identify method that is under the test

}

func (c* CombinedTool) Imperfections() string {
func (c *CombinedTool) Imperfections() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

@volodya-lombrozo how about we introduce new GitHub Action, called fmt, that will fail the build, if the sources are not properly formatted, according to the gofmt. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@h1alexbel I couldn't agree more #43

}
c.log.Info("received messsage #%s, '%s', number of attached files: %d", m.MessageID, task, 1)
c.log.Info("asking ai to find flaws in the code...")
var imperfections string
Copy link
Contributor

Choose a reason for hiding this comment

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

@volodya-lombrozo how about we implement a decorator for this logic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@h1alexbel I've reused CombinedTool here. What do you think?

@volodya-lombrozo
Copy link
Collaborator Author

@h1alexbel Could you have a look one more time, please?

Copy link
Contributor

@h1alexbel h1alexbel left a comment

Choose a reason for hiding this comment

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

@volodya-lombrozo just one comment and we are good to merge

}
c.log.Info("received messsage #%s, '%s', number of attached files: %d", m.MessageID, task, 1)
c.log.Info("asking ai to find flaws in the code...")
imperfections := NewCombinedTool(c.tool...).Imperfections()
Copy link
Contributor

Choose a reason for hiding this comment

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

@volodya-lombrozo can we inline this one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@h1alexbel Sure, done.

@volodya-lombrozo
Copy link
Collaborator Author

@h1alexbel Thank you for the comprehensive code review

@volodya-lombrozo volodya-lombrozo merged commit 0650514 into cqfn:master Jul 7, 2025
6 checks passed
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.

2 participants