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

add a rule to check that affirm is used for Assertion #1238

Open
pnatashap opened this issue Mar 20, 2024 · 5 comments
Open

add a rule to check that affirm is used for Assertion #1238

pnatashap opened this issue Mar 20, 2024 · 5 comments

Comments

@pnatashap
Copy link
Contributor

In case of using org.llorllale.cactoos.matchers.Assertion<>() affirm method should be called to perform validation.

new Assertion<>(
            "toArray() must be equals to original",
            new Immutable<>(
                new ListOf<>(1, 2)
            ).toArray(),
            new IsEqual<>(
                new ListOf<>(1, 2).toArray()
            )
        ).affirm(); // is good
new Assertion<>(
            "toArray() must be equals to original",
            new Immutable<>(
                new ListOf<>(1, 2)
            ).toArray(),
            new IsEqual<>(
                new ListOf<>(1, 2).toArray()
            )
        ); // error should be displayed, affirm is needed
Copy link

@pnatashap thanks for the report, but here some unclear moments:

  • The title of the bug report is not clear. It should be more specific and descriptive about the bug.
  • The description of the bug is not detailed enough. It should clearly state the expected and actual behavior.
  • The bug report lacks information about the environment in which the bug was found. This could include the software version, operating system, and hardware.
  • The bug report lacks steps to reproduce the bug. This is crucial for developers to understand and fix the bug.
  • The bug report does not include any error messages or logs. These can provide valuable clues about the cause of the bug.

How to fix:

  • Make the title more descriptive and specific to the bug.
  • Provide a detailed description of the bug including the expected and actual behavior.
  • Include information about the environment such as the software version, operating system, and hardware.
  • Provide clear steps to reproduce the bug.
  • Include any error messages or logs that were displayed when the bug occurred.

Please fix the bug report in order it to get resolved faster.
Analyzed with gpt-4

@IlyaPechersky
Copy link

@pnatashap can you please assign this issue to me?

@pnatashap
Copy link
Contributor Author

@IlyaPechersky I do not have permissions to assign issues, you can ask Yegor or just create a PR.
Fill free to ping me for review

@IlyaPechersky
Copy link

IlyaPechersky commented Mar 21, 2024

@pnatashap, I looked at different options, but I don’t see a suitable one. Can you please suggest me which AST class is best to use to describe org.llorllale.cactoos.matchers.Assertion<>()?
Or can you tell me who to turn to for advice?

@pnatashap
Copy link
Contributor Author

@IlyaPechersky actually you need to create a new rule, so you can check the full list and find something similar https://docs.pmd-code.org/latest/pmd_rules_java.html. For example, XPath rules is easy to write, but it is not so powerfull, some of them are implemented in code.

Example rule with the similar functionality https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/CheckResultSetRule.java

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

No branches or pull requests

2 participants