How do you get CodeClimate to ignore max-lines and max statements in a file - code-climate

We have a reducer that has 350 or so lines. Our function limit is 75 (eslint) so we get the too many lines error. We also get too many return statements, but this is a reducer and that is not a problem. How do we ignore these CodeClimate errors in this one file?
Here are the errors:

I contacted CodeClimate and they said, "We don't yet support the option to ignore specific issues for individual files.". They said to mark the error as invalid and CodeClimate won't bring it up again.

You can't ignore the specific checks for specific files.
However (and for others looking for a solution) you can exclude individual files or directories via a .codeclimate.yml file. See https://docs.codeclimate.com/docs/excluding-files-and-folders
The drawback is that it means all rules will be excluded.
If you do this, make sure you have good lint rules that do apply to those files and that can help.
Some files such as reducers and other configuration and mapping files aren't appropriate for the linting that you do want for the rest of the code.
e.g.
.codeclimate.yml
## other configuration excluded from example...
exclude_patterns:
- "imageViewer/reducer.js"

Related

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.

Add ## (Hashtags, Poundsigns, number signs, what have you) to a report header in SSRS

I have a requirement that is difficult (apparently) to try and fill. I would like to add ## as a report header, OR as the first entry in the report. The report that is being generated is being utilized by a system parser that requires the ##. I know I can create an XSLT for it, and export as XML and transfer to CSV but that seems like way too much work for something as simple as adding a ##.
The problem is, we have approximately 30 of these reports to do like this. Creating XSLTs for all of them will be very time consuming. I would greatly appreciate some support from you gurus out there!
Thank you!
Not possible -- see below:
For CSV export, the report header is determined by the DataElementName property. However the property must be CLS-compliant identifiers, but “##” is not actually CLS-compliant. By entering these characters, you’ll get the error message: Property Value is not valid. So currently, it’s not supported to keep report header with special characters when exporting to CSV file.
You can refer to the article below:
https://msdn.microsoft.com/en-us/library/dd255251.aspx
The relevant thread:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/bc7bcae8-cce2-4626-8cb9-132a239a4ab8/ssrs-2008-column-issue-when-exporting-to-a-csv-file?forum=sqlreportingservices#f9bd33ae-6d92-4050-94d8-92c6e26e00cc

How to locate & identify identical sections in multiple files?

I have about 30 files (markdown but that's mostly beside the point), and some of the files were created by copy/pasting sections from other files, so there's lots of duplication. I want to remove the duplicate sections to external "module" files so I can edit Section A in SectionA.md then include in each file that needs that section.
I want:
identical sections less than 4 lines ignored
the complete text of each repeated section
the name of the files in which that section appears
How can I achieve this?
Note: the process doesn't need to be 100% automated & 100% perfect. If there's a quick solution that dumps all the matches & filenames & I have to sort thru it some by hand, that's fine. This is a one-off task so expediency trumps robustness
Current Thoughts
I'm looking into using diff as I know it can identify identical portions of files, but I'm not sure how to map this to 30 files
I could write a program to do this (in Node just because that's what I'm familiar with) but this would probably take more time than just going thru all 30 files manually, so I disprefer this solution.

What's wrong with this user ignore file for Mercurial?

A little retrospective now that I've settled into Mercurial. Forget forget files combined with hg remove. It's crazy and bass-ackwards. You can use hg remove once you've established that something is in a forget file that isn't forgetting because the item in question was tracked before the original repo was created. Note that hg remove effectively clears tracked status but it also schedules the file for deletion in anything that gets changes from your repo. If ignored, however the tracking deactivation still happens but that delete-me change set won't ever reach another repo and for some reason will never delete in yours which IMO is counter-intuitive. It is a very sure sign that somebody and I don't know these guys, is UNWILLING TO COMPROMISE ON DUH DESIGN PROBLEMS. The important thing to understand is that you don't determine what's important, Mercurial does. Except when you're merging on a pull of course. It's entirely reasonable then. But I digress...
Ignore-file/remove is a good combo for already-tracked but very specific files you want forgotten but if you're dealing with a larger quantity of built files determined with broader patterns it's not worth the risk. Just go with a double-repo and pull -u from the remote repo to your syncing repo and then pull -u commits from your working repo and merge in a repo whose sole purpose is to merge changes and pass them on in a place where your not-quite tracked or untracked files (behavior is different when pulling rather than pushing of course because hey, why be consistent?) won't cause frustration. Trust me. The idea that you should have to have two repos just to get 'er done offends for good reason AND THAT SO MANY OF US ARE DOING IT should suggest a serioush !##$ing design problem, but it's much less painful than all the other awful things that will make you regret seeking a sensible alternative.
And use hg help. It's actually Mercurial's best feature and often better than the internet (which I don't fault for confusion on the matter of all things hg) for getting answers to everything that is confusing and counter-intuitive in this VCS.
/retrospective
# switch to regexp syntax.
syntax: regexp
#Config Files
#.Net
^somecompany\.Net[\\/]MasterSolution[\\/]SomeSolution[\\/]SomeApp[\\/]app\.config
^somecompany\.Net[\\/]MasterSolution[\\/]SomeSolution[\\/]SomeApp_test[\\/]App\.config
#and more of the same following
And in my mercurial.ini at the root of my user directory
[ui]
username = ereppen
merge = bcomp
ignore = C:\<path to user ignore file>\.hgignore-config
Context:
I wrote an auto-config utility in node. I just want changes to the files it changes to get ignored. We have two teams and both aren't on the same page with making this a universal thing so it needs to be user-specific for now.
The config file is in place and pointed at by my ini file. I clone. I run the config utility and change the files and stat reveals a list of every single file with an M next to it. I thought it was the utf-8 thing and explicitly set the file to utf-16 little endian. I don't think I'm doing with the regEx that any modern flavor of regEx worth actually calling regEx wouldn't support.
The .hgignore file has no effect for files that are tracked. Its function is to stop you from seeing files you want ignored listed as "untracked". If you're seeing "M" then they're already added (you got them with the clone) so .hgignore does nothing.
The usual way config files that differ from machine to machine are handled is to put a app.config.sample in source control, have app.config in .hgignore and have people do a copy when they're making their config edits.
Alternately if your config files allow for includes and overrides you end them with include app-local.config and override any settings in a app-local.config which you don't add and do include in .hgignore.

Need inputs for making a tool to insert preformatted comments in C/C++ source/header file

I am trying to develop a tool that inserts comments in C/C++ source files in pre-defined formats.
The comments could be:
file headers <-> file names required
class comments <-> class name required
function comments <-> function name required
Following points are required to be taken mind:
If the comments are already there in right format then leave them intact.
If the comments are broken them fix them and insert them.
Some desirable but non important features:
Check and fix the indentation.
Check if any breaks are missing in their respective cases.
Please suggest open-source / free libraries / logic to aid in this.
I guess you 've got two choices:
Generate the whole c/c++ code and headers from a template or scripting language and use this one to insert the preformated comments. This is of course not an option if you still got a lot of code.
Or you need a tool to parse the code into sth. you can further use. You could try doxygen to generate html, xml or some other format. Problem would still be, how to get the generated documentation back into your sources...