Make `cargo doc` fail if there are warnings - testing

I'd like to test in CI that cargo doc succeeds without any warnings. Is there any way to get cargo doc to exit with a non-zero exit code if there are warnings?

This should be helpful. Basically you can pass additional flags to the compiler by setting RUSTFLAGS env variable. So to deny all warnings (for any build type) is as simple as setting RUSTFLAGS="-D warnings".
EDIT. To deny warnings in the generated documentation those flags must be set by RUSTDOCFLAGS env variable instead.

Related

How to add permission flags in deno compile?

I created a script, and I want to use deno compile --unstable [src] to make it into an executable, but when I try to run the executable it says permission denied.
My question is is there a way to create the executable with permission flags like you can deno install --flag [src].
From Deno 1.7.0 on, the compile function has the same permission flags that we know from the run command.
Code that would need permissions (e.g. --allow-write) when run as a script, needs the same permissions given to the compile command.
For example, consider this short script that creates a file and writes text into it:
const write = Deno.writeTextFile("./hello.txt", "Hello World!");
write.then(() => console.log("File written to ./hello.txt"));
Run as a script with --allow-write:
> deno run --allow-write .\filewrite.ts
File written to ./hello.txt
Compiled without --allow-write. The error message could be interpreted as if you need to apply the option to the created .exe, but in fact it needs to be applied during compilation:
>deno compile --unstable .\filewrite.ts
...Emit filewrite
>.\filewrite.exe
error: PermissionDenied: write access to "./hello.txt", run again with the --allow-write flag
Compiled with the --allow-write flag:
>deno compile --unstable --allow-write .\filewrite.ts
...Emit filewrite
>.\filewrite.exe
File written to ./hello.txt
The same is of course true for the --allow-read and --allow-net flags.
The previous Deno version (1.6.3) didn't have these compiler flags and behaved as if all permissions had been granted. See the older revision of this answer

Is there a way to force `vue-cli-service build` to fail when some env variables are not set?

I use a standard .env file to store env variables and config.ts file where those variables are used. Some of them are required. I would like to ensure that the build fails when the required variables are not set.
I there a way how to achieve it? Just using vue-cli-service?
The only way I can think of now is to do a simple check in the config.ts:
if(!process.env.VUE_APP_REQUIRED_VAR) {
throw new Error('Missing required env variable: VUE_APP_REQUIRED_VAR');
}
But the exception will be thrown in runtime. Not during the build phase.
The reason behind is that many times I was solving a reported bug by a tester and found out that some env variable was not set.
#Note: Sure, I can do some prebuild steps in the pipeline, but I'd like to have it part of the local build process.

Error: No configuration set for [aws] s3_shard_formatter. This is a required configuration

I started seeing this error in flyte:
No configuration set for [aws] s3_shard_formatter. This is a required configuration.
What does it mean? AFAIK we set S3_SHARD_FORMATTER env variable in the image and also when registering the workflow.
It means the configuration object is not set. There are multiple ways to set it.
You can add it to the config file like so
[aws]
s3_shard_formatter=s3://bucket-name/{}/
s3_shard_string_length=2
You can set the environment variable FLYTE_AWS_S3_SHARD_FORMATTER to the value in the config example in 1. (or whatever your bucket name/path is).
However, usually when you see this error, what's actually happening is that the configuration option for where to look for the configuration file itself, is not being set correctly.
If you can get yourself into a Python repl, take a look at the following.
from flytekit.configuration.internal import CONFIGURATION_PATH
CONFIGURATION_PATH.get()
That path should be a /full/path/from/root. cat it too just to check that it's what you expect.
If that config option returns an empty string, then your registration step must be in error. Confirm which file is being used during registration.

Play 2 & Cloudbees: Could not resolve substitution to a value

I am deploying my Play! 2.1 application on Cloudbees.
I have in my application.conf:
# Database configuration
# ~~~~~
db.default.driver=com.mysql.jdbc.Driver
db.default.url=${MYSQL_URL_DB}
db.default.user=${MYSQL_USERNAME_DB}
db.default.password=${MYSQL_PASSWORD_DB}
I defined those values in Cloudbees configuration:
$ bees config:list -a myself/my-app
Application Parameters:
proxyBuffering=false
MYSQL_URL_DB=jdbc:cloudbees://my-app
MYSQL_USERNAME_DB=my-app
MYSQL_PASSWORD_DB=yummy
Runtime Parameters:
java_version=1.7
I publish my app using git (git push cloudbees cloudbees:master) which triggers Jenkins. But when it comes to deploying application, I get in Jenkins logs:
[error] (compile:compile)
com.typesafe.config.ConfigException$UnresolvedSubstitution:
conf/application.conf: 16: Could not resolve substitution to a value:
${MYSQL_PASSWORD_DB}
Is there anything else to do to make Jenkins aware of the configuration? Did I misunderstand something?
Thanks for your help!
Alban
You can add "?" to the beginning, so it will be treated as an override.
db.default.url=${?MYSQL_URL_DB}
You can also handle fallback situations with this approach, if you like.
db.default.url=mysql://fallback_url
db.default.url=${?MYSQL_URL_DB}
If MYSQL_URL_DB does not exist, fallback_url will be used.
This configuration is injected at runtime, not build time. You have to find a way to make the sbt build ignore unresolved substitution.
It seems a possible workaround is to set MYSQL_URL_DB=foo, etc as build environment variables, so that the check don't break, as they won't be actually injected in your configuration
I use a config like this:
https://github.com/CloudBees-community/play2-clickstart/blob/master/conf/application.conf
and a build command like this:
java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar /opt/sbt/sbt-launch-0.11.3-2.jar -Dsbt.log.noformat=true clean compile test dist
And it does not worry about the missing environment variables.
My guess is that there is a scala macro or something that triggers the compiler to resolve those variables. Adding them in is fine.
I have amended the clickstart to set default values in case they are needed.

start clang static analyzer with xcodebuild

I'm trying to set up clang static analyzer on a hudson build server and if I follow the advises in this blog post I've got the following errors:
cc1obj: error: unrecognized command line option "-fdiagnostics-print-source-range-info"
cc1obj: warnings being treated as errors
cc1obj: warning: -Wuninitialized is not supported without -O
Command /usr/local/bin/libexec/ccc-analyzer failed with exit code 1
Command /usr/local/bin/libexec/ccc-analyzer failed with exit code 1
and if I pass RUN_CLANG_STATIC_ANALYZER parameter to the xcodebuild (without using scan-build) it generates me a few plist files but I have no idea how to present those files to user because I expect for HTML output.
Does anybody succeed with this?
With Xcode 4 you can create .xcconfig files to override any methods in the project build settings. In this case make a myConfig.xcconfig and put RUN_CLANG_STATIC_ANALYZER = YES; then you can run it by calling "xcodebuild -xcconfig myConfig.xcconfig"
It's been more than two years since I asked this question and I decided to use OCLint for this purpose. Looks like a more configurable option and it supports xcodebuild from the box.