Swiftlint underscore name swift - swift

I use swiftlint in my project. The project name is ABC xx and it works fine with swiftlint. Now I decided to include Unitest in my application and I have to import #testable import ABC_xx into the swift test file which is class ABC_xxTests: XCTestCase { not I get an error with Swiftlinter which says Type Name Violation: Type name should only contain alphanumeric characters: 'ABC_xxTests' (type_name) how do I sort this error

The following swiftlint rule enable the use of underscore in your Swift class names:
type_name:
allowed_symbols: "_"
EDIT:
If you want to enable the use of underscore also for variable names use:
identifier_name:
allowed_symbols: "_"

In addition to #carmine's answer, keep the below two things in mind while adding attributes to any rule in .swiftlint.yml:
it should be listed in a new line
and should be preceded with a white space.
In my case I overlooked the white space before allowed_symbols. So the linting was not working. When I added white space, it was successful.

You can disable rule for specified folder, in your case its an ABC_xxTests folder. Inside .swiftlint.yml configuration file you can use 'excluded' property. If you haven't yet create swiftlint configuration file, you can create one with name .swiftlint.yml and place it in your project root folder.
Add this lines:
excluded:
- ABC_xxTests

Use of underscore for variable names add in .swiftlint.yml:
variable_name:
allowed_symbols: "_"

Related

Snippet: transorm TM_DIRECTORY base dir from snake_case to PascalCase

I'm trying to get "base directory" from TM_DIRECTORY variable (which gives full path) to be transformed to PascalCase (which is in snake_case).
So, for /this/is/path/to/base_dir, I want to get BaseDir
This is what I've got so far:
${TM_DIRECTORY/(^.+\\/(.*)$)/${2:/capitalize}/g} from this
which gives me:
Base_dir for /this/is/path/to/base_dir
I feel like I have to somehow incorporate ${TM_DIRECTORY/((^[a-z])|_([a-z]))/${2:/upcase}${3:/upcase}/g} but don't know how.
Use this:
"${TM_DIRECTORY/(^.+\\/(.*)$)/${2:/pascalcase}/}",
the pascalcase option is unfortunately not documented.
If that option wasn't available I would suggest this:
"${TM_DIRECTORY/.*\\/(.*)_(.*)$/${1:/capitalize}${2:/capitalize}/}",
the idea being to get the last directory in two capture groups, capitalize each and ignore the underscore separator (i.e., it doesn't appear in the transform part).
To generalize that, if you had other name separators in your directory name besides the underscore you could use this [_-] in that middle part - just include other possible separators.

How to capitalize variable in eclipse template

This is the question: I want to do a template for a header files in eclipse. So I use this syntax:
#ifndef __${file_base}_INTERFACE__
My header files names need to be lowercase. But, into the definition guard it must appear uppercase. For example my header file is named header.h. Then in my template I get __header_INTERFACE__. Although I want this __HEADER_INTERFACE__.
So how to make the variable ${file_base} to appear uppercase? Thank you!

importing less files to webstorm without explicit "#import"

Can webstorm know that less files exist in the project without using "#import"? a way of reducing the use of "#import"! or at least, to import the file without giving it the full path?
In WebStorm, variables and mixins in LESS are resolved and completed in the following way:
If element can be resolved to declaration from current file or from
explicitly imported files, then it is resolved to it without any
warnings.
If element can't be found in current file or files
available by explicit imports, but similar declaration is found in
one of project .less files, then it is resolved just by name.
Resolved element is marked with a weak-warning inspection 'Resolved
by name only'.
Completion list for variables and mixins includes all variables/mixins from all files in project. Elements defined in current file or in explicitly imported files are placed on the top of completion list and have bold font. Variables/mixins from other files are marked with 'implicitly imported'-hint.
as for import paths, please see comments in WEB-7452 for possible workarounds

How to make file starting with underscore ( _ ) appear in output?

In my JS library I've noticed that none of the files starting with an underscore are appearing in my output from JSDoc3. These are marked using #module and I've tried adding #public and also building with the -p switch but I can't seem to get them appearing. Any ideas how to solve this?
I've discovered that if you run JSDoc using a configuration file (http://usejsdoc.org/about-configuring-jsdoc.html#configuration-file-command-line) you can update the excludePattern which by default includes files starting with the underscore pattern.

How to create custom terminal grammar for xtext?

My grammar file is already too large and is causing the error:
The code for the static initializer is exceeding the 65535 bytes limit.
So, I want to split my grammar into 2 xtext files, and create a separate custom terminal.xtext to lower down the size of my grammar file.
I have an xtext project in org.xtext.rpcIDL, where my RpcIDL.xtext is in its src directory.
I have read here that its possible to have 2 grammar files in one project. But I cannot add another grammar file in my current project. When I right-click, then go to New, there is no option there to add a new xtext file.
How can I add a custom xtext file in my project?
I don't know if you already found out the solution by yourself but in case you didn't:
To create a new Xtext-File in your project right click in your org.xtext.rpcIDLwhich should be in your text-project under src (The one with the package symbol in front of it), then go to New->File and then you just have to give it a name and add the extension .xtext. That will add the xtext-nature to your project. After that you have to add the line grammar ... (just copy this line of your other file and change the last element to the name of your new File). Then add with and enter the name of your other xtext-file (this is the one which stands after the generate in your other file. Then you should be able to use the elements of all the features which you have declared in your original File.
I hope I could help you.
Greets Krzmbrzl