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

Added clippy check. #65

Merged
merged 27 commits into from
Nov 28, 2020
Merged

Added clippy check. #65

merged 27 commits into from
Nov 28, 2020

Conversation

5c077m4n
Copy link
Contributor

No description provided.

@5c077m4n 5c077m4n marked this pull request as draft November 21, 2020 20:04
@roee-shapira-tikal
Copy link

@imsnif not too bad, right?

with:
toolchain: stable
components: clippy
- uses: actions-rs/clippy@master
Copy link

@roee-shapira-tikal roee-shapira-tikal Nov 21, 2020

Choose a reason for hiding this comment

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

@imsnif This version needs to be changed asap.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I'm not sure I understand?

Choose a reason for hiding this comment

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

The master tag as it's not versioned.
But from what I see it's not really being developed actively

Comment on lines 319 to 324
while let Some((current_index, current_line)) = indices_and_canonical_lines.next() {
if current_index == canonical_line_cursor_position {
y += current_line.wrapped_fragments.len() - line_wrap_cursor_position;
break;
} else {
y += current_line.wrapped_fragments.len();
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems much nicer

src/screen.rs Outdated
@@ -67,6 +67,7 @@ pub enum ScreenInstruction {
ClearScroll,
CloseFocusedPane,
ToggleActiveTerminalFullscreen,
#[allow(dead_code)]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about adding warning suppressions (similarly for the other allow directives)

Copy link
Member

Choose a reason for hiding this comment

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

I feel the same... @5c077m4n - could you share the reasoning here?

Copy link
Member

Choose a reason for hiding this comment

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

ah, oops - didn't realize this was already changed

@imsnif
Copy link
Member

imsnif commented Nov 23, 2020

@5c077m4n - looking good! I'm fine with everything here. What else needs to be done? Do you also want to take care of some of the warnings we've got?

@5c077m4n 5c077m4n marked this pull request as ready for review November 23, 2020 17:26
@imsnif
Copy link
Member

imsnif commented Nov 23, 2020

Also, could you merge from main? There are some changes there that might need to run through these tests

@@ -142,7 +142,7 @@ impl Screen {
let pid = new_pids.next().unwrap(); // if this crashes it means we got less pids than there are panes in this layout
let mut new_terminal = TerminalPane::new(
*pid,
self.full_screen_ws.clone(),
self.full_screen_ws,

Choose a reason for hiding this comment

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

@imsnif clippy really does not like the .clone() here, is it necessary?

Copy link
Member

Choose a reason for hiding this comment

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

I think this is Copy, so no need for sure. It's probably a leftover from a refactor.

Choose a reason for hiding this comment

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

😎

@imsnif
Copy link
Member

imsnif commented Nov 24, 2020

@5c077m4n - so is this ready?

fn atomic_create_file(file_name: &str) {
let _ = fs::OpenOptions::new().create(true).open(file_name);
fn atomic_create_file(file_name: &str) -> io::Result<fs::File> {
fs::OpenOptions::new().create(true).open(file_name)
Copy link
Member

Choose a reason for hiding this comment

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

@5c077m4n - the previous way was actually intentional. This is "atomic" create file, meaning that it's okay for it to fail if the file already exists.

Copy link

@roee-shapira-tikal roee-shapira-tikal Nov 24, 2020

Choose a reason for hiding this comment

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

Reverted. Sorry 🤦

@roee-shapira-tikal
Copy link

This is nearly done, there are just a couple of more minor changes that you might want to look at yourself @imsnif (like src/main.rs:309:41)

@imsnif
Copy link
Member

imsnif commented Nov 24, 2020

So... is this ready for review or not?

@roee-shapira-tikal
Copy link

Yep, now it is

Copy link
Member

@imsnif imsnif left a comment

Choose a reason for hiding this comment

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

Really great work on this! I imagine this was not trivial.

I left some general comments. I'm looking into the stdin error (it might be the cause of some of our troubles). But until then (and on top of my comments in the code): why is the build not failing? It has two errors and several warnings. Shouldn't it be red?

_ => {}
if let Some(&25) = params.get(0) {
self.scroll.show_cursor();
self.mark_for_rerender();
};
}
} else if c == 'r' {
Copy link
Member

Choose a reason for hiding this comment

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

@5c077m4n - I can't comment on the lines below directly for some reason, but can we disable this clippy check? The one with the errors about the identical ifs. I would really like to leave it like this for now. The comments are super important and this block is generally very much in-flux as we keep reverse-engineering the VT100 protocol.

}

pub fn delete_log_file() -> io::Result<()> {
pub fn _delete_log_file() -> io::Result<()> {
Copy link
Member

Choose a reason for hiding this comment

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

The functions in this file are general utility functions. Can we add exceptions for them so that we don't have to prefix them with underscores? It would just be confusing and annoying while debugging :)

@roee-shapira-tikal
Copy link

@imsnif the tests are not failing because this clippy github actions is not really being developed, I've looked some other possibility but this still looks better
And about the clippy exceptions there are annotations that can disable the warnings (#[allow(clippy::...)])

@imsnif
Copy link
Member

imsnif commented Nov 24, 2020

@imsnif the tests are not failing because this clippy github actions is not really being developed, I've looked some other possibility but this still looks better

So... I guess this solution doesn't do the job for us? If we can't see the failures on PRs, then this essentially will not be part of our CI. Or am I missing something?

And about the clippy exceptions there are annotations that can disable the warnings (#[allow(clippy::...)])

Cool - so can we add them?

@imsnif
Copy link
Member

imsnif commented Nov 24, 2020

Also (if we're going forward with this) we should either address the warnings or have them not appear inside the code-browsing. Because it's hard to review PRs with them.

@roee-shapira-tikal
Copy link

Sure, I'll do what you asked tonight/tomorrow morning @imsnif

@imsnif
Copy link
Member

imsnif commented Nov 24, 2020

Sure, I'll do what you asked tonight/tomorrow morning @imsnif

Awesome. But just to stress: we need some sort of failure in our CI for this to be meaningful. I don't mind it even being a hack, like a test-case running clippy or whatever :)

@roee-shapira-tikal
Copy link

😎

@5c077m4n
Copy link
Contributor Author

@imsnif after some research I found that there are three possibilities to clippy check in the ci:

  1. an action that can't check PRs
  2. an action that doesn't fail the build
  3. an action that does not show the errors on the pr reviews
    Other than creating a brand new action I don't really an easy way of using this tool...

@imsnif
Copy link
Member

imsnif commented Nov 26, 2020

I see... thanks for all the research! Does number 3 still check PRs and fail the build though?

@5c077m4n
Copy link
Contributor Author

5c077m4n commented Nov 26, 2020

Yep, that's what's configured for now

@imsnif
Copy link
Member

imsnif commented Nov 26, 2020

Alright, so maybe it can be a good compromise?

@5c077m4n
Copy link
Contributor Author

Great :) in that case this branch is ready for your review @imsnif

Copy link
Member

@imsnif imsnif left a comment

Choose a reason for hiding this comment

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

Great work as always. Thanks for doing this! I think we will all appreciate it :)

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.

None yet

4 participants