Codacy - Is it possible to turn off rule for specified paths using codacy.yaml file? - codacy

I couldn't find the information in Codacy documentation or github repositories, but has anyone ever tried turning off rules for specific paths? This is a complete guess what it could look like:
---
engines:
detekt:
exclude_rules:
TooManyFunctions:
exclude_paths:
- '**/tests/**'
exclude_paths:
- "**.sh"
- "**.md"
- "frontend/example/**"

You can achieve that by using the config file for detekt instead: https://detekt.dev/docs/introduction/configurations/#path-filters--excludes--includes
Codacy will use the native configuration file from the tool and you can specify the ignores by rule there.

Related

Apache metacharacters

I need to set up 500 different virtualhost in apache (httpd), with the same configuration. I thought it could be possible to use metacharacters or loops, instead of copying the same 500 times...
I tried to search some information, but I couldn't find any workaround. Does anybody know something regarding this issue?
Thank you all!
Looks like mod_macro might be what you are looking for.
Straight from the documentation:
Provides macros within Apache httpd runtime configuration files, to
ease the process of creating numerous similar configuration blocks.
When the server starts up, the macros are expanded using the provided
parameters, and the result is processed as along with the rest of the
configuration file.

PHPStan, exclude all and specify files to check

Im trying to setup PHPStan on a older, bigger, codebase. How could i exclude everything and than maybe by config define what to analyse.
I have thought about using a separate folder for it, but that would mean constantly moving files which might lead to breaking of the code. So i am hoping to exclude everything and then adding files to the analysers per file.
At this moment the only solution i was able to find is defining a script in composer.json
"scripts": {
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=1G --no-progress --level 1 `cat phpstan_analyse_files`"
}
And keeping a list of files to analyise in the file phpstan_analyse_files
The best way to do what you need is excludePaths section as of PHPStan 1.0:
# phpstan.neon
parameters:
excludePaths:
- 'old-code/OldClass.php'
- 'another-old-code/*'
See docs or this real project phpstan.neon setup for inspiration.

Boost.Log Configuration Files

I'm adding logging to an old C++ program. After some research, I've decided to use Boost Log . The documentation is filled with examples of creating sinks and filters. However, I couldn't find any example of a log configuration file.
Is there a way to configure logging from a file that doesn't have to be compiled? Similar to what log4net has? Or Python (well, since Python isn't compiled, anyway...) ?
Eventually I found the official documentation, either it was added recently, or it is well hidden so that I didn't see it before:
http://www.boost.org/doc/libs/1_57_0/libs/log/doc/html/log/detailed/utilities.html#log.detailed.utilities.setup.settings_file
Unfortunately, I can't find an exhaustive answer neither, but some observations:
Certainly it is possible to use a configuration file:
boost::log::init_from_stream(std::basic_istream< CharT > &)
Example of the file (from Boost log severity_logger init_from_stream):
[Sinks.MySink]
Destination=Console
Format="%LineID%: <%Severity%> - %Message%"
From the following link you can identify additional valid setting keys and values (e.g. Destination=TextFile, Filter=, AutoFlush=, FileName=)
http://boost.2283326.n4.nabble.com/log-init-from-settings-problem-with-applying-format-and-filter-td3643483.html
Constants in boost's parser_utils.hpp give another idea of keywords that are by default supported by the configuration file (E.g. section [Core] with key DisableLogging).
Providing settings for user defined types is described here (with a corresponding snippet of the configuration file at the end of the page):
http://www.boost.org/doc/libs/1_57_0/libs/log/doc/html/log/extension/settings.html
It seems to me that it is difficult to find a description of the configuration file format entries because the valid entries are derived from the source code implementing the sinks, filters etc. This implementation may be even user defined so it is impossible to give explicit configuration format description.
Maybe you can try to create your configuration in a programmatic way and when transforming it to the form of the configuration file, you can open separate questions for the particular properties that you are not able find out how to set them.

How can I exclude a folder from an Artifact Path on TeamCity?

I have an Artifact path like the following:
%system.teamcity.build.workingDir%\Presentation\obj\Release\Package=>Package.zip
But I need to exclude a folder from "Package", I´ve tried things like:
%system.teamcity.build.workingDir%\Presentation\obj\Release\Package
-:%system.teamcity.build.workingDir%\Presentation\obj\Release\Package\PackageTmp
-:Package\PackageTmp
But nothing seems to work, any ideas ?
Greetings.
Exclusion patterns are not supported yet for artifact paths. There is an issue in TeamCity tracker requesting this functionality. Please watch/vote.
Additionally, there is this workaround. Have a look, if it fits your needs

Upload - Exclude File Type

I'm currently using Node.js and minifying CSS and JS files with PHP Storm 7.1 and I'd like to only upload the *.min version of the file.
I'm not certain how to even go about this. Can a regular expression be used here? If yes, which expression would work best?
After searching online and trying multiple options I came up with the following regex which seems to do the job:
*[^min].css;*[^min].js
I set this under File -> Settings -> Deployment -> Options for Exclude items by name.
Running a manual upload it appears only the .min.css / .min.js files are being uploaded which is exactly what I was looking for.