How to disable the character limit in swiftlint config file - ios

I am working on a project and i need to how to disable the character limit in swiftlint config file , so how to disable the character limit ??
Here is the swiftlint file
disabled_rules:
- force_cast
- force_try
- variable_name
- type_name
- file_length
- type_body_length
- cyclomatic_complexity
- function_body_length
- valid_docs
- trailing_whitespace
opt_in_rules:
- empty_string
excluded:
- Carthage
- Pods
- SwiftLint/Common/3rdPartyLib
line_length:
warning: 150
error: 200
ignores_function_declarations: true
ignores_comments: true
ignores_urls: true
custom_rules:
smiley_face:
name: "Smiley Face"
regex: '( :\))'
match_kinds:
- comment
- string
message: "A closing parenthesis smiley :) creates a half-hearted smile, and thus is not preferred. Use :]"
severity: warning

If you face some problem with this warning:
Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'by' (identifier_name)
You can add these command to your configuration file:
variable_name:
max_length:
warning: 45
error: 60
min_length:
warning: 1
I hope this helps you and fits with your question.

I guess you can do it adding line_length inside disabled_rules, if that's what you mean.

Related

Where can I put test data that is not part of a model?

I want to test against a list of invalid email addresses. At the moment, they live in my setup method:
def setup
#invalid_email_addresses = [
'plainaddress',
'##%^%#$##$##.com',
'#domain.com',
'Joe Smith <email#domain.com>',
'email.domain.com',
'email#domain#domain.com',
'.email#domain.com',
'email.#domain.com',
'email..email#domain.com',
'あいうえお#domain.com',
'email#domain.com (Joe Smith)',
'email#domain',
'email#-domain.com',
'email#domain.web',
'email#111.222.333.44444',
'email#domain..com'
]
end
This makes the method rather long. I would like to move them to a yml file:
# test/fixtures/email_addresses.yml
invalid_email_addresses:
- 'plainaddress'
- '##%^%#$##$##.com'
- '#domain.com'
- 'Joe Smith <email#domain.com>'
- 'email.domain.com'
- 'email#domain#domain.com'
- '.email#domain.com'
- 'email.#domain.com'
- 'email..email#domain.com'
- 'あいうえお#domain.com'
- 'email#domain.com (Joe Smith)'
- 'email#domain'
- 'email#-domain.com'
- 'email#domain.web'
- 'email#111.222.333.44444'
- 'email#domain..com'
But that results in an error for each test:
ActiveRecord::Fixture::FormatError: fixture key is not a hash: /Users/stefan_edberg/Rails/tennis_app/test/fixtures/emaild_addresses.yml, keys: ["invalid_email_addresses"]
If not in fixtures, where should I put these email addresses?
The error shared itself conveys that there is some problem in parsing the YAML contents. I saved the following contents in a file test.yml on my Desktop
# test/fixtures/email_addresses.yml
invalid_email_addresses:
- 'plainaddress'
- '##%^%#$##$##.com'
- '#domain.com'
- 'Joe Smith <email#domain.com>'
- 'email.domain.com'
- 'email#domain#domain.com'
- '.email#domain.com'
- 'email.#domain.com'
- 'email..email#domain.com'
- 'あいうえお#domain.com'
- 'email#domain.com (Joe Smith)'
- 'email#domain'
- 'email#-domain.com'
- 'email#domain.web'
- 'email#111.222.333.44444'
- 'email#domain..com'
and then tried loading it from irb and it successfully loaded:
Please Note: Initially when I copied the YAML contents as it is in my file and tried loading it, I encountered parsing error and then I removed the following entry and tried again and the parse was successful
- 'あいうえお#domain.com'`
That entry contains Unicode characters. As YAML is indentation-sensitive copying that entry as it is in my file made the indentation inconsistent which caused parse error. Fixing the indentation for that entry made the parse successful.

Implementing check in policy in swift 4

Suppose I have a class like this:
class person{
}
I need to implement a policy to check my code and warn me using camel case for my class name (use Person instead of person)
How can I do it in Swift?
I think you make use of SwiftLint for all kinds of Coding guidelines and you can set rules in your yml file, Please refer to SwiftLint for more details
As an example, the yml file looks like,
opt_in_rules:
- force_unwrapping
- empty_count
- explicit_init
- closure_spacing
- overridden_super_call
- redundant_nil_coalescing
- nimble_operator
- attributes
- operator_usage_whitespace
- closure_end_indentation
- first_where
- object_literal
- number_separator
- prohibited_super_call
- fatal_error_message
disabled_rules:
- type_name
- trailing_whitespace
- identifier_name
- class_delegate_protocol
- nesting
file_length:
warning: 1000
error: 1200
type_body_length:
- 200 # warning
- 300 # error
identifier_name:
excluded:
- id
line_length: 300
number_separator:
minimum_length: 5
function_parameter_count:
warning: 6
error: 9

OBIEE -- Syntax Error with Substring?

I'm looking at the following code as an edit to a field formula in an OBIEE analysis, yet returns an error. Any thoughts?
SUBSTRING("Dim - Vendor Header"."Dock Time",
LOCATE(':',"Dim - Vendor Header"."Dock Time")+1,
(CHAR_LENGTH("Dim - Vendor Header"."Dock Time") -
LOCATE(':',REVERSE("Dim - Vendor Header"."Dock Time")) -
LOCATE(':',"Dim - Vendor Header"."Dock Time")))
The error follows:
Formula syntax is invalid.
[nQSError: 10058] A general error has occurred. [nQSError: 43113] Message
returned from OBIS. [nQSError: 27002] Near <)>: Syntax error [nQSError:
26012] .Please have your System Administrator look at the log for more
details on this error. (HY000)
SQL Issued: SET VARIABLE DISABLE_CACHE_HIT=1; SELECT Substring ("Dim -
Vendor Header"."Dock Time", LOCATE(':',"Dim - Vendor
Header"."Dock Time")+1) FROM "XHSS - Vendor"
OK (Ignore Error)
Is there any function string REVERSE in obiee12c ?
Can you please try by giving only below part in formula, and check the same error is getting...
(CHAR_LENGTH("Dim - Vendor Header"."Dock Time") - LOCATE(':',REVERSE("Dim - Vendor Header"."Dock Time"))

Why does Swift lint ignore my custom regular expression?

My .swiftlint.yml file:
disabled_rules:
- trailing_whitespace
- mark
- line_length
- force_cast
- variable_name
- force_try
- cyclomatic_complexity
- function_body_length
- type_body_length
- file_length
- type_name
excluded:
- Pods
custom_rules:
press_enter_after_object_definition:
regex: "(class|enum).*"
The result is following:
Why it has found only first match?
I need to find every line with enum or class keyword.
Remove the .*, this means match anything except a line break. So it appears to die in SwiftLint after the first line break of a successful match.
This works:
press_enter_after_object_definition:
regex: "(class|enum)"

How change yeoman generator-webapp settings to make uploadble files

I begin to use yeoman to make web pages. I finished almost. And I typed 'grunt' not 'grunt serve' to make up-loadable files.
terminal said errors below.But Cords work.
what should I fix.
app/scripts/main.js
2:3 error Strings must use singlequote quotes
2:3 error Expected indentation of 4 space characters but found 2 indent
5:7 error "slideqty" is defined but never used no-unused-vars
50:5 error "map" is defined but never used no-unused-vars
52:1 error Expected indentation of 2 space characters but found 0 indent
55:17 error "google" is not defined no-undef
58:13 error "google" is not defined no-undef
62:1 error "google" is not defined no-undef
62:1 error Expected indentation of 2 space characters but found 0 indent
✖ 22 problems (22 errors, 0 warnings)
Warning: Task "eslint:target" failed. Use --force to continue.
Aborted due to warnings.

Resources