Browse Source

fix(tooling): clippy

Lucas Nogueira 4 years ago
parent
commit
7660a23d22
4 changed files with 297 additions and 72 deletions
  1. 4 0
      tooling/bundler/src/lib.rs
  2. 5 0
      tooling/cli.rs/build.rs
  3. 283 72
      tooling/cli.rs/schema.json
  4. 5 0
      tooling/cli.rs/src/main.rs

+ 4 - 0
tooling/bundler/src/lib.rs

@@ -3,6 +3,10 @@
 // SPDX-License-Identifier: MIT
 
 #![warn(missing_docs, rust_2018_idioms)]
+#![allow(
+    // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422
+    clippy::nonstandard_macro_braces,
+)]
 
 //! The Tauri bundler is a tool that generates installers or app bundles for executables.
 //! It supports auto updating through [tauri](https://docs.rs/tauri).

+ 5 - 0
tooling/cli.rs/build.rs

@@ -2,6 +2,11 @@
 // SPDX-License-Identifier: Apache-2.0
 // SPDX-License-Identifier: MIT
 
+#![allow(
+    // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422
+    clippy::nonstandard_macro_braces,
+)]
+
 use std::{
   env::current_dir,
   error::Error,

+ 283 - 72
tooling/cli.rs/schema.json

@@ -228,11 +228,17 @@
       "properties": {
         "beforeBuildCommand": {
           "description": "a shell command to run before `tauri build` kicks in",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "beforeDevCommand": {
           "description": "a shell command to run before `tauri dev` kicks in",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "devPath": {
           "description": "The path or URL to use on development.",
@@ -254,14 +260,20 @@
         },
         "features": {
           "description": "features passed to `cargo` commands",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "runner": {
           "description": "The binary used to build and run the application.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "withGlobalTauri": {
           "description": "Whether we should inject the Tauri API on `window.__TAURI__` or not.",
@@ -280,10 +292,16 @@
           "type": "boolean"
         },
         "category": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "copyright": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "deb": {
           "default": {
@@ -297,24 +315,36 @@
           ]
         },
         "externalBin": {
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "icon": {
           "description": "The app's icons",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "identifier": {
           "description": "The app's identifier",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "longDescription": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "macOS": {
           "default": {
@@ -328,13 +358,19 @@
         },
         "resources": {
           "description": "App resources to bundle. Each resource is a path to a file or directory. Glob patterns are supported.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "shortDescription": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "targets": {
           "description": "The bundle targets, currently supports [\"deb\", \"app\", \"msi\", \"appimage\", \"dmg\"] or \"all\"",
@@ -379,129 +415,197 @@
     "CliArg": {
       "description": "A CLI argument definition",
       "type": "object",
-      "required": ["name"],
+      "required": [
+        "name"
+      ],
       "properties": {
         "conflictsWith": {
           "description": "Sets a conflicting argument by name i.e. when using this argument, the following argument can't be present and vice versa.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "conflictsWithAll": {
           "description": "The same as conflictsWith but allows specifying multiple two-way conflicts per argument.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "description": {
           "description": "The argument description which will be shown on the help information. Typically, this is a short (one line) description of the arg.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "index": {
           "description": "The positional argument index, starting at 1.\n\nThe index refers to position according to other positional argument. It does not define position in the argument list as a whole. When utilized with multiple=true, only the last positional argument may be defined as multiple (i.e. the one with the highest index).",
-          "type": ["integer", "null"],
+          "type": [
+            "integer",
+            "null"
+          ],
           "format": "uint64",
           "minimum": 0.0
         },
         "longDescription": {
           "description": "The argument long description which will be shown on the help information. Typically this a more detailed (multi-line) message that describes the argument.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "maxValues": {
           "description": "Specifies the maximum number of values are for this argument. For example, if you had a -f <file> argument where you wanted up to 3 'files', you would set .max_values(3), and this argument would be satisfied if the user provided, 1, 2, or 3 values.",
-          "type": ["integer", "null"],
+          "type": [
+            "integer",
+            "null"
+          ],
           "format": "uint64",
           "minimum": 0.0
         },
         "minValues": {
           "description": "Specifies the minimum number of values for this argument. For example, if you had a -f <file> argument where you wanted at least 2 'files', you would set `minValues: 2`, and this argument would be satisfied if the user provided, 2 or more values.",
-          "type": ["integer", "null"],
+          "type": [
+            "integer",
+            "null"
+          ],
           "format": "uint64",
           "minimum": 0.0
         },
         "multiple": {
           "description": "Specifies that the argument may appear more than once.\n\n- For flags, this results in the number of occurrences of the flag being recorded. For example -ddd or -d -d -d would count as three occurrences. - For options there is a distinct difference in multiple occurrences vs multiple values. For example, --opt val1 val2 is one occurrence, but two values. Whereas --opt val1 --opt val2 is two occurrences.",
-          "type": ["boolean", "null"]
+          "type": [
+            "boolean",
+            "null"
+          ]
         },
         "multipleOccurrences": {
           "description": "specifies that the argument may appear more than once.",
-          "type": ["boolean", "null"]
+          "type": [
+            "boolean",
+            "null"
+          ]
         },
         "name": {
           "description": "The unique argument name",
           "type": "string"
         },
         "numberOfValues": {
-          "type": ["integer", "null"],
+          "type": [
+            "integer",
+            "null"
+          ],
           "format": "uint64",
           "minimum": 0.0
         },
         "possibleValues": {
           "description": "Specifies a list of possible values for this argument. At runtime, the CLI verifies that only one of the specified values was used, or fails with an error message.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "requireEquals": {
           "description": "Requires that options use the --option=val syntax i.e. an equals between the option and associated value.",
-          "type": ["boolean", "null"]
+          "type": [
+            "boolean",
+            "null"
+          ]
         },
         "required": {
           "description": "Sets whether or not the argument is required by default.\n\n- Required by default means it is required, when no other conflicting rules have been evaluated - Conflicting rules take precedence over being required.",
-          "type": ["boolean", "null"]
+          "type": [
+            "boolean",
+            "null"
+          ]
         },
         "requiredIfEq": {
           "description": "Allows specifying that an argument is required conditionally with the signature [arg, value] the requirement will only become valid if the `arg`'s value equals `${value}`.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "requiredUnlessPresent": {
           "description": "Sets an arg that override this arg's required setting i.e. this arg will be required unless this other argument is present.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "requiredUnlessPresentAll": {
           "description": "Sets args that override this arg's required setting i.e. this arg will be required unless all these other arguments are present.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "requiredUnlessPresentAny": {
           "description": "Sets args that override this arg's required setting i.e. this arg will be required unless at least one of these other arguments are present.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "requires": {
           "description": "Tets an argument by name that is required when this one is present i.e. when using this argument, the following argument must be present.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "requiresAll": {
           "description": "Sts multiple arguments by names that are required when this one is present i.e. when using this argument, the following arguments must be present.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "requiresIf": {
           "description": "Allows a conditional requirement with the signature [arg, value] the requirement will only become valid if `arg`'s value equals `${value}`.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "short": {
           "description": "The short version of the argument, without the preceding -.\n\nNOTE: Any leading - characters will be stripped, and only the first non - character will be used as the short version.",
-          "type": ["string", "null"],
+          "type": [
+            "string",
+            "null"
+          ],
           "maxLength": 1,
           "minLength": 1
         },
         "takesValue": {
           "description": "Specifies that the argument takes a value at run time.\n\nNOTE: values for arguments may be specified in any of the following methods - Using a space such as -o value or --option value - Using an equals and no space such as -o=value or --option=value - Use a short and no space such as -ovalue",
-          "type": ["boolean", "null"]
+          "type": [
+            "boolean",
+            "null"
+          ]
         }
       },
       "additionalProperties": false
@@ -512,30 +616,48 @@
       "properties": {
         "afterHelp": {
           "description": "adds additional help information to be displayed in addition to auto-generated help this information is displayed after the auto-generated help information this is often used to describe how to use the arguments, or caveats to be noted.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "args": {
           "description": "list of args for the command",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "$ref": "#/definitions/CliArg"
           }
         },
         "beforeHelp": {
           "description": "adds additional help information to be displayed in addition to auto-generated help this information is displayed before the auto-generated help information. this is often used for header information",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "description": {
           "description": "command description which will be shown on the help information",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "longDescription": {
           "description": "command long description which will be shown on the help information",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "subcommands": {
           "description": "list of subcommands of this command.\n\nsubcommands are effectively sub-apps, because they can contain their own arguments, subcommands, usage, etc. they also function just like the app command, in that they get their own auto generated help and usage",
-          "type": ["object", "null"],
+          "type": [
+            "object",
+            "null"
+          ],
           "additionalProperties": {
             "$ref": "#/definitions/CliConfig"
           }
@@ -547,7 +669,10 @@
       "type": "object",
       "properties": {
         "depends": {
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
@@ -666,25 +791,43 @@
       "type": "object",
       "properties": {
         "entitlements": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "exceptionDomain": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "frameworks": {
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "license": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "minimumSystemVersion": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "signingIdentity": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "useBootstrapper": {
           "default": false,
@@ -708,11 +851,17 @@
       "properties": {
         "productName": {
           "description": "App name. Automatically converted to kebab-case on Linux.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "version": {
           "description": "App version.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         }
       },
       "additionalProperties": false
@@ -721,7 +870,10 @@
       "type": "object",
       "properties": {
         "csp": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         }
       },
       "additionalProperties": false
@@ -746,7 +898,9 @@
     },
     "SystemTrayConfig": {
       "type": "object",
-      "required": ["iconPath"],
+      "required": [
+        "iconPath"
+      ],
       "properties": {
         "iconPath": {
           "description": "Path to the icon to use on the system tray.\n\nIt is forced to be a `.png` file on Linux and macOS, and a `.ico` file on Windows.",
@@ -897,18 +1051,27 @@
         "dialog": {
           "description": "Display built-in dialog or use event system if disabled.",
           "default": true,
-          "type": ["boolean", "null"]
+          "type": [
+            "boolean",
+            "null"
+          ]
         },
         "endpoints": {
           "description": "The updater endpoints.",
-          "type": ["array", "null"],
+          "type": [
+            "array",
+            "null"
+          ],
           "items": {
             "type": "string"
           }
         },
         "pubkey": {
           "description": "Optional pubkey.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         }
       },
       "additionalProperties": false
@@ -953,21 +1116,33 @@
         },
         "height": {
           "description": "The window height.",
-          "type": ["number", "null"],
+          "type": [
+            "number",
+            "null"
+          ],
           "format": "double"
         },
         "label": {
           "description": "The window identifier.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "maxHeight": {
           "description": "The max window height.",
-          "type": ["number", "null"],
+          "type": [
+            "number",
+            "null"
+          ],
           "format": "double"
         },
         "maxWidth": {
           "description": "The max window width.",
-          "type": ["number", "null"],
+          "type": [
+            "number",
+            "null"
+          ],
           "format": "double"
         },
         "maximized": {
@@ -977,12 +1152,18 @@
         },
         "minHeight": {
           "description": "The min window height.",
-          "type": ["number", "null"],
+          "type": [
+            "number",
+            "null"
+          ],
           "format": "double"
         },
         "minWidth": {
           "description": "The min window width.",
-          "type": ["number", "null"],
+          "type": [
+            "number",
+            "null"
+          ],
           "format": "double"
         },
         "resizable": {
@@ -992,7 +1173,10 @@
         },
         "title": {
           "description": "The window title.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "transparent": {
           "description": "Whether the window is transparent or not.",
@@ -1001,7 +1185,10 @@
         },
         "url": {
           "description": "The window webview URL.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "visible": {
           "description": "Whether the window is visible or not.",
@@ -1010,17 +1197,26 @@
         },
         "width": {
           "description": "The window width.",
-          "type": ["number", "null"],
+          "type": [
+            "number",
+            "null"
+          ],
           "format": "double"
         },
         "x": {
           "description": "The horizontal position of the window's top left corner",
-          "type": ["number", "null"],
+          "type": [
+            "number",
+            "null"
+          ],
           "format": "double"
         },
         "y": {
           "description": "The vertical position of the window's top left corner",
-          "type": ["number", "null"],
+          "type": [
+            "number",
+            "null"
+          ],
           "format": "double"
         }
       },
@@ -1030,13 +1226,22 @@
       "type": "object",
       "properties": {
         "certificateThumbprint": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "digestAlgorithm": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "timestampUrl": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "wix": {
           "anyOf": [
@@ -1096,7 +1301,10 @@
         },
         "license": {
           "description": "Path to the license file.",
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         },
         "mergeRefs": {
           "default": [],
@@ -1110,10 +1318,13 @@
           "type": "boolean"
         },
         "template": {
-          "type": ["string", "null"]
+          "type": [
+            "string",
+            "null"
+          ]
         }
       },
       "additionalProperties": false
     }
   }
-}
+}

+ 5 - 0
tooling/cli.rs/src/main.rs

@@ -2,6 +2,11 @@
 // SPDX-License-Identifier: Apache-2.0
 // SPDX-License-Identifier: MIT
 
+#![allow(
+    // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422
+    clippy::nonstandard_macro_braces,
+)]
+
 pub use anyhow::Result;
 use clap::{crate_version, load_yaml, App, AppSettings, ArgMatches};
 use dialoguer::Input;