Skip to content

feat(#2): aibolit integration#38

Merged
volodya-lombrozo merged 16 commits intocqfn:masterfrom
h1alexbel:2
Jul 5, 2025
Merged

feat(#2): aibolit integration#38
volodya-lombrozo merged 16 commits intocqfn:masterfrom
h1alexbel:2

Conversation

@h1alexbel
Copy link
Contributor

@h1alexbel h1alexbel commented Jul 3, 2025

In this PR I've implemented integration with aibolit, in order to supply critic with problems in the Java code, already found by aibolit.

closes #2

@h1alexbel
Copy link
Contributor Author

@volodya-lombrozo could you take a look, please?

README.md Outdated
- `--token, -t`: Token for the AI provider.
- `--debug, -d`: Enable debug logging.

Also, make sure you have [aibolit] installed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@h1alexbel I believe it should be a supplementary tool, not a required one. In other words, refrax should work even without aibolit

Copy link
Contributor Author

@h1alexbel h1alexbel Jul 4, 2025

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 parameter: --tools, that will signal which tool we should use for linting, aibolit or something else. WDYT?

@@ -0,0 +1,5 @@
package aibolit

type Aibolit interface {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@h1alexbel aibolit is not the only way we can search flaws in the code. Actually, we can use plain linters, spell-checkers and so on. Thus, aibolit is just a tool that can be used by critic. What do you think if we rename this interface to Tool or Linter (or something else?) Then, the concrete implementation of it would be Aibolit instead of DefaultAibolit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@volodya-lombrozo agree, Tool is a good name for that

// @todo #2:45min Implement support for Aibolit with multiple classes.
// As for now, we check only the first class, and return imperfections result. Instead, we need to support
// multiple files instead. Let's implement such Aibolit struct, that will be able to manage whole project, instead
// of single Java file. Also see this related issue: https://github.com/cqfn/refrax/issues/28.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@h1alexbel Maybe we need to place this todo in aibolit.go file? What do you think?

`

func NewCritic(ai brain.Brain, port int) *Critic {
func NewCritic(ai brain.Brain, port int, aibolit aibolit.Aibolit) *Critic {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@h1alexbel Can we pass a variadic number of tools here? (e.g. tools ...tool)

"errors"
"testing"

"github.com/cqfn/refrax/internal/aibolit"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@h1alexbel What do you think if we put aibolit under the critic folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@volodya-lombrozo indeed, it would be better

@h1alexbel
Copy link
Contributor Author

@volodya-lombrozo updated. Take a look, please

Copy link
Collaborator

@volodya-lombrozo volodya-lombrozo left a comment

Choose a reason for hiding this comment

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

@h1alexbel Looks good to me! Thank you for the contribution

@volodya-lombrozo volodya-lombrozo merged commit 2f65fcd into cqfn:master Jul 5, 2025
6 checks passed
@h1alexbel h1alexbel deleted the 2 branch July 5, 2025 13:14
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.

Integrate refrax with aibolit for ML-based refactoring insights

2 participants