Skip to content

Commit

Permalink
Merge pull request #2793 from mjsterckx/sdk-clippy-lint
Browse files Browse the repository at this point in the history
Makefile: changed Rust lint clippy to the one included in SDK
  • Loading branch information
mjsterckx authored Mar 2, 2023
2 parents bb73a4c + 54bb6bc commit 92aba85
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 19 deletions.
15 changes: 11 additions & 4 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,21 @@ rc=0
export VARIANT="${BUILDSYS_VARIANT}"
# For rust first-party source code
if ! cargo clippy \
--manifest-path ${BUILDSYS_TOOLS_DIR}/Cargo.toml \
if ! docker run --rm \
-v "$(pwd)":/tmp \
"${BUILDSYS_SDK_IMAGE}" \
cargo clippy \
--manifest-path /tmp/tools/Cargo.toml \
--locked -- -D warnings --no-deps; then
rc=1
fi
if ! cargo clippy \
--manifest-path ${BUILDSYS_SOURCES_DIR}/Cargo.toml \
if ! docker run --rm \
-v "$(pwd)":/tmp \
-e VARIANT \
"${BUILDSYS_SDK_IMAGE}" \
cargo clippy \
--manifest-path /tmp/sources/Cargo.toml \
--locked -- -D warnings --no-deps; then
rc=1
fi
Expand Down
45 changes: 32 additions & 13 deletions tools/pubsys/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,20 +644,23 @@ mod error {
#[snafu(display("Failed to add new target '{}' to repo: {}", path.display(), source))]
AddTarget {
path: PathBuf,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Failed to build target metadata from path '{}': {}", path.display(), source))]
BuildTarget {
path: PathBuf,
source: tough::schema::Error,
#[snafu(source(from(tough::schema::Error, Box::new)))]
source: Box<tough::schema::Error>,
},

#[snafu(display("Failed to copy target '{}' to '{}': {}", target.display(), path.display(), source))]
CopyTarget {
target: PathBuf,
path: PathBuf,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Error reading config: {}", source))]
Expand All @@ -667,7 +670,10 @@ mod error {
CreateDir { path: PathBuf, source: io::Error },

#[snafu(display("Failed to create repo editor from given repo: {}", source))]
EditorFromRepo { source: tough::error::Error },
EditorFromRepo {
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Failed to read '{}': {}", path.display(), source))]
File { path: PathBuf, source: io::Error },
Expand All @@ -685,7 +691,8 @@ mod error {
LinkTarget {
target: PathBuf,
path: PathBuf,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Failed to write Manifest to '{}': {}", path.display(), source))]
Expand All @@ -701,7 +708,10 @@ mod error {
MissingRepoUrls { repo: String },

#[snafu(display("Failed to create new repo editor: {}", source))]
NewEditor { source: tough::error::Error },
NewEditor {
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Repo does not have a manifest.json: {}", metadata_url))]
NoManifest { metadata_url: Url },
Expand All @@ -718,7 +728,8 @@ mod error {
#[snafu(display("Failed to read target '{}' from repo: {}", target, source))]
ReadTarget {
target: String,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Failed to create async runtime: {}", source))]
Expand All @@ -727,7 +738,8 @@ mod error {
#[snafu(display("Failed to parse target name from string '{}': {}", target, source))]
ParseTargetName {
target: String,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Repo exists at '{}' - remove it and try again", path.display()))]
Expand All @@ -743,31 +755,38 @@ mod error {
))]
RepoLoad {
metadata_base_url: Url,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Requested repository does not exist: '{}'", url))]
RepoNotFound { url: Url },

#[snafu(display("Failed to sign repository: {}", source))]
RepoSign { source: tough::error::Error },
RepoSign {
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Failed to write repository to {}: {}", path.display(), source))]
RepoWrite {
path: PathBuf,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Failed to set targets expiration to {}: {}", expiration, source))]
SetTargetsExpiration {
expiration: DateTime<Utc>,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Failed to set targets version to {}: {}", version, source))]
SetTargetsVersion {
version: u64,
source: tough::error::Error,
#[snafu(source(from(tough::error::Error, Box::new)))]
source: Box<tough::error::Error>,
},

#[snafu(display("Failed to set waves from '{}': {}", wave_policy_path.display(), source))]
Expand Down
5 changes: 4 additions & 1 deletion tools/testsys-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,10 @@ mod error {
context(false),
display("Failed to create template for cluster name: {}", source)
)]
TemplateError { source: handlebars::TemplateError },
TemplateError {
#[snafu(source(from(handlebars::TemplateError, Box::new)))]
source: Box<handlebars::TemplateError>,
},

#[snafu(
context(false),
Expand Down
5 changes: 4 additions & 1 deletion tools/testsys/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ pub enum Error {
context(false),
display("Unable create template from yaml: {}", source)
)]
HandlebarsTemplate { source: handlebars::TemplateError },
HandlebarsTemplate {
#[snafu(source(from(handlebars::TemplateError, Box::new)))]
source: Box<handlebars::TemplateError>,
},

#[snafu(display("Unable to create map from {}: {}", what, source))]
IntoMap { what: String, source: model::Error },
Expand Down

0 comments on commit 92aba85

Please sign in to comment.