pylint3 Variable name "fl" doesn't conform to snake_case naming style (invalid-name) - pylint

According to this pylint-wiki, it seems that 2 letter variable names are ok:
Variable variable-rgx [a-z_][a-z0-9_]{2,30}$
But for some reason I get the following error:
Variable name "fl" doesn't conform to snake_case naming style (invalid-name)

The regular expression says:
A letter or underscore
Followed by at least 2 letters, underscores or digits
In total this sums up to at least 3 characters per variable name.

Related

a%&8b is valid variable name or not in BASIC

a%&8b is valid variable name basic
Suggest me if it is valid in VB6
Help me. It is my exams
a%&8b is NOT a valid name. Specifically, you cannot have & and % in the name.
The rules for VBA are:
You must use a letter as the first character.
You can't use a space, period (.), exclamation mark (!), or the characters #, &, $, # in the name.
Name can't exceed 255 characters in length.
Another source on VB6 lists the following:
Variable names in Visual Basic are made up of letters (upper and lower case) and digits. The underscore character, "_", is also permitted. Names must not begin with a digit. Names can be as long as you like.
Some examples of valid (but not very descriptive) Visual Basic variable names:
foo
Bar
BAZ
foo_bar
a_foo42_
QuUx
Some examples of invalid Visual Basic variable names:
2foo
must not begin with a digit
my foo
spaces not allowed in names
$foo
$ not allowed -- only letters, digits, and _
while
language keywords cannot be used as names
_xxx
leading underscore not allowed.

What is #__instance__ in Ruby?

Rails uses it here in rails/activesupport/lib/active_support/inflector/inflections.rb
#__instance__ = Concurrent::Map.new
The meaning is mentioned nowhere in Ruby variable name with double underscores.
The underscore is a legal character in an identifier. It has no meaning whatsoever.
(There is one exception: local variables that start with an underscore will not generate a warning if they are unused.)
In other words: the meaning of #__instance__ is exactly the same as the meaning of #foobar: there is no meaning.

How to use variables with a dash in the name in Freemarker?

I'm trying to render a map that has keys containing minus signs (e.g. first-name), e.g.:
<head><title>Data - ${first-name} </title>
When I render it with FreeMarker, it complains and throws an exception. When I remove the '-' from the variable name, it works OK.
Is there any way to escape these variables in the Groovy template text?
The reason I'm doing it this way is to render a JSON blob from a 3rd party API, where I have no control over the variable-names.
Just checked the Freemarker manual. In chapter "Retrieving variables" you have the following statement:
For example, to read the variable whose name is "data-id", the
expression is data\-id, as data-id would be interpreted as "data minus
id". (Note that these escapes only work in identifiers, not in string
literals.)
These type of expressions work fine in Freemarker 2.3.23 (just tested to verify the documentation):
<#if test\-dash??>
${test\-dash}
</#if>
Only if you are using freemarker version from 2.3.22 or above. See freemarker variable syntax:
In this kind of expression, the variable name can only contain letters (including non-Latin letters), digits (including non-Latin digits), underline (_), dollar ($), at sign (#). Furthermore, the first character can't be a ASCII digit (0-9). Starting from FreeMarker 2.3.22, the variable name can also contain minus (-), dot (.), and colon (:) at any position, but these must be escaped with a preceding backslash (\), or else they would be interpreted as operators.

Significance of an ampersand in VB6 function name?

I just got a bunch of legacy VB6 (!) code dumped on me and I keep seeing functions declared with an ampersand at the end of the name, for example, Private Declare Function ShellExecute& . . ..
I've been unable to find an answer to the significance of this, nor have I been able to detect any pattern in use or signature of the functions that have been named thusly.
Anyone know if those trailing ampersands mean anything to the compiler, or at least if there's some convention that I'm missing? So far, I'm writing it off as a strange programmer, but I'd like to know for sure if there's any meaning behind it.
It means that the function returns a Long (i.e. 32-bit integer) value.
It is equivalent to
Declare Function ShellExecute(...) As Long
The full list of suffixes is as follows:
Integer %
Long &
Single !
Double #
Currency #
String $
As Philip Sheard has said it is an indentifier type for a Long. They are still present in .Net, see this MSDN link and this VB6 article
From the second article:
The rules for forming a valid VB variable name are as follows:
(1) The first character must be a letter A through Z (uppercase or
lowercase letters may be used). Succeeding characters can be letters,
digits, or the underscore (_) character (no spaces or other characters
allowed).
(2) The final character can be a "type-declaration character". Only
some of the variable types can use them, as shown below:
Data Type Type Declaration Character
String $
Integer %
Long &
Single !
Double #
Currency #
Use of type-declaration
characters in VB is not encouraged; the modern style is to use the
"As" clause in a data declaration statement.

Allowed characters in map key identifier in YAML?

Which characters are and are not allowed in a key (i.e. example in example: "Value") in YAML?
According to the YAML 1.2 specification simply advises using printable characters with explicit control characters being excluded (see here):
In constructing key names, characters the YAML spec. uses to denote syntax or special meaning need to be avoided (e.g. # denotes comment, > denotes folding, - denotes list, etc.).
Essentially, you are left to the relative coding conventions (restrictions) by whatever code (parser/tool implementation) that needs to consume your YAML document. The more you stick with alphanumerics the better; it has simply been our experience that the underscore has worked with most tooling we have encountered.
It has been a shared practice with others we work with to convert the period character . to an underscore character _ when mapping namespace syntax that uses periods to YAML. Some people have similarly used hyphens successfully, but we have seen it misconstrued in some implementations.
Any character (if properly quoted by either single quotes 'example' or double quotes "example"). Please be aware that the key does not have to be a scalar ('example'). It can be a list or a map.

Resources