What is the default value for an omitted rules in TSLint? - tslint

I looked through the documentation but couldn't figure out what the default value of a rule in TSLint is. If I don't specify one of the rules found here (https://palantir.github.io/tslint/rules/) then does it default to false?

According to the Configuring TSLint page:
Rule severity
The severity level of each rule can be configured to default, error, warning/warn, or off/none. If no severity level is specified, default is used. The defaultSeverity top-level option replaces the severity level for each rule that uses severity level default in the current file. Valid values for defaultSeverity include error, warning/warn, and off/none.
and
defaultSeverity?: "error" | "warning" | "off": The severity level that is applied to rules in this config file as well as rules in any inherited config files which have their severity set to “default”. If undefined, “error” is used as the defaultSeverity.
To answer your question: the default value for an omitted rule is the value of defaultSeverity and if defaultSeverity is not set the default value is error.
Note also that if you have:
"extends": "tslint:recommended"
in your tslint.json, you inherit all values set in recommended.js.

Related

How to know which CONFIG_XXX corresponding a module?

Is there a command or some tools that can help you get the corresponding CONFIG_XXX options to enable a module. For example, if I want to enable module nvme, which CONFIG_XXX should be y or m?
I know there are some documents which may states the config of nvme. But I want to know if there is a command or tool which can help you get the CONFIG——XXX only if you type a command.
Thanks.
if I want to enable module nvme, which CONFIG_XXX should be y or m?
As far as I know, there is no documentation or single-purpose command that would report the specific configuration symbol that builds a module.
However the Makefile that actually specifies the building of the module in question is the sole authoritative source for this information.
Typically the relevant Makefile would be in the subdirectory (or the parent directory) as the source module.
If you're not sure where the source module resides, then you could search all the Makefile files in the kernel source for the conditional build of the .o object file:
$ find . -name Makefile | xargs grep nvme.o
./drivers/nvme/host/Makefile:obj-$(CONFIG_BLK_DEV_NVME) += nvme.o
... <irrelevant search results>
$
So the answer would be CONFIG_BLK_DEV_NVME.
Note that the subdirectory that has the relevant Makefile will also have the Kconfig file that describes the configuration symbol you just identified.
Rather than manually edit the .config file, use the make menuconfig command.
Using the menuconfig assures you that your configuration will meet all dependencies and trigger all auto-selections properly.
You can use the search feature (simply type the slash character, /, and the config name) to retrieve help text to guide you to the location of the configuration prompt.
The help text and status of CONFIG_BLK_DEV_NVME could look like:
Symbol: BLK_DEV_NVME [=n]
Type : tristate
Prompt: NVM Express block device
Location:
-> Device Drivers
(1) -> NVME Support
Defined at drivers/nvme/host/Kconfig:4
Depends on: PCI [=n] && BLOCK [=y]
Selects: NVME_CORE [=n]
Selected by [n]:
- NVM [=n] && BLOCK [=y] && PCI [=n]
The current configuration state/status of each configuration entry mentioned is displayed within square brackets and an equals sign.
The Depends on: line indicates that both CONFIG_PCI and CONFIG_BLOCK have to be enabled in order for the CONFIG_BLK_DEV_NVME prompt to be even visible.
You may have to use the search capability to convert these other CONFIG_xxx names to their menu prompts and locations.
The Selects: line indicates the other configuration entries that will be automatically enabled if this config item is selected.
The Selected by [x]: line(s) indicates the other configuration entries that could automatically enable this config item. In this case the logical expression indicates that when three other config entries are enabled, this config is also enabled automatically.
You can search the options in the interactive kernel configuration menu but you have to build the menu first via make menuconfig, then type / followed by the term you're looking for. Each Symbol: in the search results is followed by the option name without CONFIG_ prefix. It also shows location of the option in the menu tree.
Some of the options are tristate: y - the feature is going to be built into the kernel image, m - the feature should reside in a loadable module, n - the feature is disabled.
You need to add CONFIG_BLK_DEV_NVME=m (either edit .config or use make menuconfig) to enable support of nvmeNnM block devices as a loadable module.

go exec command security linting messages using golangci

I'm adding a linter for gosec for golangci-lint and everything is covered except the following:
exec.Command(params[0], params[1:]…)
I know that I can disable this lint but I don't want to do it. Is there a way to fix the code to satisfy this lint?
the error is:
G204: Subprocess launched with function call as argument or cmd arguments ```
Instead of disabling the linter you could exclude the specific line with an annotation;
exec.Command(params[0], params[1:]...) //nolint:gosec
If you want to disable only this check, you can
exec.Command(params[0], params[1:]...) // #nosec G204
Hardcode a command call. There are no other options AFAIS.
Update: starting from version 1.40 you gosec options are customizable, see example config .golangci.example.yml in https://github.com/golangci/golangci-lint repository.
linters-settings:
gosec:
# To select a subset of rules to run.
# Available rules: https://github.com/securego/gosec#available-rules
includes:
- G401
- G306
- G101
# To specify a set of rules to explicitly exclude.
# Available rules: https://github.com/securego/gosec#available-rules
excludes:
- G204
# To specify the configuration of rules.
# The configuration of rules is not fully documented by gosec:
# https://github.com/securego/gosec#configuration
# https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/rules/rulelist.go#L60-L102
config:
G306: "0600"
G101:
pattern: "(?i)example"
ignore_entropy: false
entropy_threshold: "80.0"
per_char_threshold: "3.0"
truncate: "32"

wxWidget C1189 #error: "wxUSE_ACTIVEX must be defined."

I use VS2015+ wxwideget 3.10 to run a very simple example from wxwidget examples
Yesterday this example was able to run properly but today the example starts to display "Error C1189 #error: "wxUSE_ACTIVEX must be defined." when building it. I didn't change the configuration settings so this thing is quite confusing. Where could be the bugs?
the place where error occured(in chkconf.h):
f/* ensure that MSW-specific settings are defined */
#ifndef wxUSE_ACTIVEX
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_ACTIVEX must be defined."
# else
# define wxUSE_ACTIVEX 0
# endif
#endif /* !defined(wxUSE_ACTIVEX) */
my property settings:
additional include directories: $(WXWIN)\include; $(WXWIN)\include\msvc;
additional library directories: $(WXWIN)\lib\vc_x64_lib
First of all, it's completely impossible that something that worked yesterday stopped working today without anything else. You did change something and, of course, only you know what it was.
Second, all wxUSE_XXX constants are defined in include/wx/msw/setup.h which is copied to lib/vc_x64_lib/mswu/wx (or another similar directory depending on debug/release, lib/DLL build settings) during the library build and is found there by by include/msvc/wx/setup.h. So if it's not defined, the first thing to do is to check that this file didn't get changed somehow (maybe accidentally, although I have trouble imagining how this could happen).

Sonarqube6.7 lack of 'import unknown files' option

I want to scan a text file such as how much line in a .sh file. In sonarqube6.7 unknown files = true option is missing. I was in sonar-project.properties file to configure sonar.import_unknown_files = true also was not used. Does a higher version support unknown files?
The property sonar.import_unknown_files has no effect with SQ 6.7. By default, all the files are indexed (SONAR-8623). Then SQ keeps only the files on which a given Sensor (a plugin) saved something on it (SONAR-8631).
For your case, you need a custom plugin that:
declares a new language dealing with .sh files (similar to: https://github.com/SonarSource/sonar-custom-plugin-example/blob/master/src/main/java/org/sonarsource/plugins/example/languages/FooLanguage.java)
implements a Sensor implementing some logic to raise issues/metrics on your .sh files

TeamCity AutoIncrementer Plugin Modify Build Number

I'm using the TeamCity AutoIncrementer Plugin: https://confluence.jetbrains.com/display/TW/Autoincrementer
I'm attempting to modify the config file at: [TeamCity Data Directory]/config/autoincrementer.properties
Within the config file it says:
# Autoincrementer plugin (pre 6.5 EAP).
#
# This file contains values for auto-incremented properties.
# Each auto-incremented property must start with 'autoinc_Test.' prefix.
# Value of the property must be a positive integer.
# To use auto-incremented property in a build you can add a reference to the property
# in build configuration settings, e.g: %autoinc_Test.build.number%. When plugin discovers such reference
# initial value for the referenced property will be written in this file.
# You can change properties values in this file manually at any time.
# Note that if you want to set a property to some value you need to put ! character
# before the value (after the equals sign).
My values look like:
autoinc.foo=1683367\:25
autoinc.bar=-1\:10
I believe the first number is the changelist from Perforce.
I want to change the last number for foo from 25 to 200 (this is the build number).
I've tried putting the exclamation character at autoinc.foo=!1683367:200 and at autoinc.foo=1683367:!200. In both cases TeamCity will overwrite this file and change it back to 26 on the next build.
1) How do I change the build number? Does this require a TeamCity restart?
2) How is this working at all if each autoinc requires 'autoinc_Test.' prefix?
I am using TeamCity 8.0.6.
The version we are using works by adding a ! after the = sign as per the comments in the file (e.g. autoinc.globalbuildnum=!1).
I noticed that the comments in the version we are using are different to those you have posted. We are using the plugin that is compatible with TeamCity 8.x+ which is currently at the link you posted. It was updated on 7th April 2015

Resources