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 support for passing options to the Clippy command #295

Merged
merged 1 commit into from
Jul 1, 2023

Conversation

iensu
Copy link
Contributor

@iensu iensu commented Jun 22, 2023

Pass additional options such as -W clippy::pedantic to the cargo clippy command.

Closes #294

@iensu
Copy link
Contributor Author

iensu commented Jun 22, 2023

I was not able to successfully run the tests on neither this branch nor master.

The tests fail with this error message:

Initialized empty Git repository in /nix/store/9w0y65m316afyxai0wzfv8ivgwqb9i93-dep/.git/
[master (root-commit) 35d815e] Initial commit
 6 files changed, 18 insertions(+)
 create mode 100644 Cargo.toml
 create mode 100644 dep/Cargo.lock
 create mode 100644 dep/Cargo.toml
 create mode 100644 dep/src/lib.rs
 create mode 120000 dep/symlink.txt
 create mode 100644 original.txt
building '/nix/store/ynzdiva2rab2vhhi4x8hfhy6hsszwwpv-app.drv'...
copying path '/nix/store/zbb2p7i6wv7c8xa0s4gzb0rq7080glc7-lndir-1.0.3' from 'https://cache.nixos.org'...
building '/nix/store/53w7y6dc8ajkzgvz6hzi28p6nzklfwal-src.drv'...
fatal: detected dubious ownership in repository at '/nix/store/h15ps5rm3b8c30147yrd7zin443ab4sz-dep'
To add an exception for this directory, call:

        git config --global --add safe.directory /nix/store/h15ps5rm3b8c30147yrd7zin443ab4sz-dep
error: program 'git' failed with exit code 128

@nmattia
Copy link
Collaborator

nmattia commented Jun 23, 2023

I was not able to successfully run the tests on neither this branch nor master.

@Patryk27 this looks like the issue you fixed in #288, right? Worth cherry-picking that?

nmattia
nmattia previously approved these changes Jun 23, 2023
Copy link
Collaborator

@nmattia nmattia left a comment

Choose a reason for hiding this comment

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

Looking good, thanks! I suspect you'll need to update the README manually (or run ./scripts/gen)

@Patryk27
Copy link
Contributor

@Patryk27 this looks like the issue you fixed in #288, right? Worth cherry-picking that?

Oh yes, that's the one - I'll cherry pick it!

@iensu iensu force-pushed the feature/clippy-mode-options branch from 564bb68 to f7bca2d Compare June 23, 2023 11:05
@iensu
Copy link
Contributor Author

iensu commented Jun 23, 2023

@nmattia I updated the README

@Patryk27
Copy link
Contributor

@iensu could you check if this patch fixes the tests? 👀

diff --git a/test/default.nix b/test/default.nix
index 75097f6..cc7e2c1 100644
--- a/test/default.nix
+++ b/test/default.nix
@@ -2,9 +2,22 @@
 let
   sources = import ../nix/sources.nix;
 
-  pkgs = import ../nix {
-    inherit system nixpkgs;
-  };
+  pkgs =
+    let
+      pkgs' = import ../nix {
+        inherit system nixpkgs;
+      };
+
+      older-pkgs = import ../nix {
+        inherit system;
+
+        nixpkgs = "nixpkgs-21.05";
+      };
+
+    in
+    pkgs' // {
+      git = older-pkgs.git;
+    };
 
   naersk = pkgs.callPackage ../default.nix {
     inherit (pkgs.rustPackages) cargo rustc;

@iensu
Copy link
Contributor Author

iensu commented Jun 24, 2023

@Patryk27 Nopes, I get the same issue :(

@Patryk27
Copy link
Contributor

Patryk27 commented Jun 24, 2023

Ouch! Which OS / machine are you using?

@iensu
Copy link
Contributor Author

iensu commented Jun 24, 2023

I'm running NixOS on a Samsung laptop (model NP900X3G). It only has 4GB of memory, so I wonder if I'm running into an OOM error, but nothing in the error message indicates that.

uname output:

Linux xibalba 6.1.34 #1-NixOS SMP PREEMPT_DYNAMIC Wed Jun 14 09:15:34 UTC 2023 x86_64 GNU/Linux

@Patryk27
Copy link
Contributor

Alright, I've managed to reproduce this (funnily, on an Ubuntu with Nix installed separately) 😅

It's related to the fact that some of Naersk's tests create Git repos dynamically:

  dep = pkgs.runCommand "dep" {
    buildInputs = [ pkgs.git ];
  } ''
    mkdir $out
    cd $out
    cp -ar ${./fixtures/dep}/* .

    git init
    git add .
    git config user.email 'someone'
    git config user.name 'someone'
    git commit -am 'Initial commit'
  '';

... which causes them to be put in /nix/store under the root user, and that doesn't play well with (some version of) Git 🙃

Anyway, since it seems to work correctly on CI (maybe we're running something akin to sudo nix-build there?), let's test it on CI and I'll think of some solution later, in a separate MR.

@iensu
Copy link
Contributor Author

iensu commented Jun 25, 2023

Good you managed to reproduce it! Seems like a potentially hairy issue :)

Copy link
Contributor

@Patryk27 Patryk27 left a comment

Choose a reason for hiding this comment

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

Thanks! 🚀

@Patryk27 Patryk27 merged commit 714e701 into nix-community:master Jul 1, 2023
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.

Passing options to clippy
3 participants