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

Adding analyzer feedback for secrets concept exercise #2736

Merged

Conversation

manumafe98
Copy link
Contributor

@manumafe98 manumafe98 commented Feb 21, 2024

pull request

closes #2685

This solution could be a great example to see if we want to ask the operator ~ to be used 100% or be flexible and only ask for the & one

Reviewer Resources:

Track Policies

@manumafe98 manumafe98 added the x:size/small Small amount of work label Feb 21, 2024
@manumafe98 manumafe98 self-assigned this Feb 21, 2024
@sanderploegsma
Copy link
Contributor

@kahgoh you recently authored this exercise, do you have any suggestions to add or improve?

@kahgoh
Copy link
Member

kahgoh commented Feb 28, 2024

I think it looks good. I can't think of anything else to add or improve.

@manumafe98
Copy link
Contributor Author

@kahgoh I don't think you could see the content of the link on the description of the PR, just in case I was referring to this

A student solve the exercise like this:

    public static int clearBits(int value, int mask) {
        int and = value & mask;
        return and ^ value;
    }

Instead of the most common solution, that would be like this:

    public static int clearBits(int value, int mask) {
        return value & ~mask ;
    }

Do you think we should allow it, or remark to use ~ in the analyzer?

@kahgoh
Copy link
Member

kahgoh commented Feb 29, 2024

@manumafe98 Sorry, I did miss the link in the PR's description. I think that is certainly a valid solution because it is still using bit operators, even though I didn't think of it when I created the exercise. From that perspective, I think if they use value & mask ^ value it should be allowed, although (if possible) we could suggest to try using & and ~ for a shorter solution.

@manumafe98
Copy link
Contributor Author

@manumafe98 Sorry, I did miss the link in the PR's description. I think that is certainly a valid solution because it is still using bit operators, even though I didn't think of it when I created the exercise. From that perspective, I think if they use value & mask ^ value it should be allowed, although (if possible) we could suggest to try using & and ~ for a shorter solution.

Great, then I separated the ~ operator from the essential comment and I added an extra informative one.

@manumafe98 manumafe98 merged commit 78627da into exercism:main Feb 29, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/small Small amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

secrets: describe Analyzer feedback in .meta/design.md
3 participants