-
Notifications
You must be signed in to change notification settings - Fork 401
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
Suggested changes #1752
base: master
Are you sure you want to change the base?
Suggested changes #1752
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
75d15b9
to
bb5d7af
Compare
doc/SECURITY.md
Outdated
We do not save any of your code in Postgres. | ||
We do store the contents of the files to review temporarily in Sidekiq, and it | ||
gets cleared out as soon as the job is processed. | ||
We store single lines of your code in Postgres, which is encrypted and encoded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about explaining this a bit more:
We only store single lines of code that we detected a linter violation
Or something? So we explain exactly which lines we store.
7d42a53
to
fa327d7
Compare
c80cf7a
to
b8ddf22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of comments. LGTM.
app/services/suggest_changes.rb
Outdated
when /Put a comma after the last parameter of a multiline method call/ | ||
self.suggestion = violation.source << "," | ||
when /Missing semicolon/ | ||
self.suggestion = violation.source << ";" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dos violation.source << ";"
mutate the violation.source
? Maybe +
or interpolation is safer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good call. Done.
suggested changes. The data is encrypted and encoded similar to tokens using | ||
`ActiveSupport::MessageEncryptor`. We also store the contents of the files to | ||
review temporarily in Redis, but that is removed as soon as the Sidekiq job is | ||
processed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
result = suggest_changes.call | ||
|
||
expect(result).to eq <<~COMMENT.chomp | ||
Put a comma after the last parameter of a multiline method call.<br>```suggestion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding \n
before or after <br>
in the code, so these assertions don't look so whacky?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean. If I do that then the tests will fail because the messages won't match. 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm referring to this line: https://github.com/houndci/hound/pull/1752/files#diff-326c371081e0ec9a5f273d1c45b64541R20
If we add an \n
, like:
messages + "\n<br>```suggestion\n#{suggestion}\n```"
then this test line would look like:
Put a comma after the last parameter of a multiline method call.
<br>```suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gylaz works for me, done.
|
||
def apply_suggestion(message) | ||
case message | ||
when /Trailing whitespace detected/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gylaz we need to figure out a better way to generate these suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, though not sure how "smart" we want to get about these.
fff3d3c
to
7d17f02
Compare
7d17f02
to
d48f119
Compare
No description provided.