-
Notifications
You must be signed in to change notification settings - Fork 4
Dont annotate errors to files #17
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
base: master
Are you sure you want to change the base?
Conversation
7even
left a comment
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 think this needs some tests.
…dd `config.debug`
c19c6f9 to
a27461d
Compare
|
Tests added. |
| backticks = '# ```' | ||
| annotation.unshift(backticks).push(backticks) | ||
|
|
||
| if annotation.first.start_with?("# create_table") |
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.
@Morozzzko will this work for views, or we need something like annotation.first.start_with?("# create_table") || annotation.first.start_with?("# create_view")? Can you tell us how the views look like in your app's annotations?
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'll check and tell you by Tuesday evening
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.
Sorry I'm late. It says create_table even if it's a view
Probably because it's a materialized view, not sure
create_table :table_name id: false, force: :cascade do |t|
| end | ||
|
|
||
| @lines.unshift(*annotation, nil) | ||
| elsif configurator.debug |
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 think this should be
| elsif configurator.debug | |
| elsif configurator.debug? |
| let(:configurator) { | ||
| c = ActiveRecord::Annotate::Configurator.new | ||
| c.debug = true | ||
| c |
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.
This can be simplified to ActiveRecord::Annotate::Configurator.new.tap { |c| c.debug = true }.
| expect(new_file).not_to be_changed | ||
| end | ||
| end | ||
|
|
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.
Redundant empty line.
| ### Doesnt add new annotation to non-annotated file | ||
| new_file.annotate_with(["error"], configurator) | ||
| expect(new_file).not_to be_changed | ||
| end |
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 don't get the idea of this test. You are re-annotating the file with the same annotation and then checking that it didn't change :) Also the title assumes that old annotation should get removed which is not what happens here.
|
I have some other more important tasks on the go and you seem to have lots of comments and insight. Do you have any interest in picking up this PR and finishing it? |
Solves #11
config.debug = trueto puts errorsNote: this is untested so far I merely wrote it.