Showing 103 of 106 total issues
Single-line comment should start with whitespace Open
//// Devices Service
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */
Single-line comment should start with whitespace Open
//// Menu Service
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */
Variable names should be lowerCamelCase Open
private var _services: Services
- Read upRead up
- Exclude checks
lower-camel-case
method
and var
names should follow lowerCamelCase naming convention: first letter of the entire word is lowercase, but subsequent first letters are uppercase.
Method and selector names
Preferred
func someMethod() {
// method definition goes here
}
Not Preferred
func some-method() {
// method definition goes here
}
Variable names
Preferred
var someVariable = someValue
Not Preferred
var Some_Var1able = someValue
Multiline comment should end with whitespace Open
**/
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */
Line should not have any trailing whitespace Open
- Read upRead up
- Exclude checks
trailing-whitespace
Flag whitespace after the last non-whitespace character on each line until the newline.
Preferred
let number = 42¬
Not Preferred
let number = 42••¬
Function should have at least one blank line before it Open
fileprivate func resolveCommercialContext(type: CommercialEvent,
- Read upRead up
- Exclude checks
function-whitespace
Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.
Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Not Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Function should have at least one blank line after it Open
}
- Read upRead up
- Exclude checks
function-whitespace
Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.
Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Not Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Function should have at least one blank line before it Open
static func endpoint(forService settings: RPCServiceSettings) -> RPCEndpoint {
- Read upRead up
- Exclude checks
function-whitespace
Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.
Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Not Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Function should have at least one blank line before it Open
func prepare() {
- Read upRead up
- Exclude checks
function-whitespace
Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.
Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Not Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Function should have at least one blank line after it Open
}
- Read upRead up
- Exclude checks
function-whitespace
Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.
Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Not Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Function should have at least one blank line after it Open
}
- Read upRead up
- Exclude checks
function-whitespace
Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.
Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Not Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Multiline comment should end with whitespace Open
**/
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */
Single-line comment should start with whitespace Open
//// Protobuf Types
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */
Global Constant should be either lowerCamelCase or UpperCamelCase Open
internal let __BLOOMBOX_VERSION__ = "0.5.0"
- Read upRead up
- Exclude checks
constant-naming
Global constants should follow either UpperCamelCase or lowerCamelCase naming conventions. Local constants should follow lowerCamelCase naming conventions.
Preferred
let MaxHeight = 42
let maxHeight = 42
Not Preferred
let max_height = 42
Multiline comment should end with whitespace Open
**/
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */
Function closing brace should be isolated on a separate line Open
func prepare() { /* default: no-op */ }
- Read upRead up
- Exclude checks
brace-style
Definitions of
- class
- struct
- function
- Control flow constructs (if
, else if
, else
, switch
, for
, while
, repeat-while
)
- init
- protocol
- enum
- closure
- Getters and Setters (set
, get
)
- extension
should follow the One True Brace Style (1TBS): each construct has its opening brace one the same line along with the same indentation level as its header, the statements within the braces are indented, and the closing brace at the end is on the same indentation level as the header of the function at a line of its own. Braces are not omitted for a control statement with only a single statement in its scope. Every opening brace must also have one space preceding it.
Classes
Preferred
class SomeClass {
}
class SomeClass: SomeSuperClass {
}
Not Preferred
class SomeClass
{
}
class SomeClass: SomeSuperClass{
}
Structs
Preferred
struct SomeStruct {
}
struct SomeStruct : SomeParentStruct {
}
Not Preferred
struct SomeStruct
{
}
struct SomeStruct : SomeParentStruct {
}
Functions
Preferred
func someMethod() {
}
func someOtherFunction () -> () {
}
Not Preferred
func someMethod()
{
}
func someOtherFunction () -> ()
{
}
Control flow constructs
- if, else if, and else statement
Preferred
if SomeCondition {
} else if someOtherCondition {
} else {
}
Not Preferred
if SomeCondition
{
}
else if someOtherCondition
{
}
else
{
}
- switch statement
Preferred
switch SomeData {
default:
break
}
Not Preferred
switch SomeData
{
default:
break
}
- for loop
Preferred
for var i = 0; i < 10; i+=1 {
}
Not Preferred
for var i = 0; i < 10; i+=1
{
}
- while loop
Preferred
while SomeCondition {
}
Not Preferred
while SomeCondition
{
}
- repeat-while loop
Preferred
repeat {
} while SomeCondition
Not Preferred
repeat
{
} while SomeCondition
Initializers
Preferred
init(someParameter:Double, someOtherParameter:Double) {
self.someMember = someParameter
self.someOtherMember = someOtherParameter
}
Not Preferred
init(someParameter:Double, someOtherParameter:Double)
{
self.someMember = someParameter
self.someOtherMember = someOtherParameter
}
Protocols
Preferred
protocol SomeProtocol {
}
protocol SomeOtherProtocol : X {
}
Not Preferred
protocol SomeProtocol
{
}
protocol SomeOtherProtocol : X
{
}
Enums
Preferred
enum SomeEnum {
case A, B, C, D
}
enum SomeEnum {
case A
case B
case C
case D
}
enum SomeEnum: Int {
case A, B, C = 5, D
}
Not Preferred
enum SomeEnum
{
case A, B, C, D
}
enum SomeEnum
{
case A
case B
case C
case D
}
enum SomeEnum: Int
{
case A, B, C = 5, D
}
Closures
Preferred
func someFunction () -> () {
// closure
}
Not Preferred
func someFunction () -> ()
{
// closure
}
Setters and Getters
- set
Preferred
set {
oldValue = newValue / 2
}
Not Preferred
set
{
oldValue = newValue / 2
}
- get
Preferred
get {
return value * 2
}
Not Preferred
get
{
return value * 2
}
Extensions
Preferred
extension someExtension {
}
Not Preferred
extension someExtension
{
}
Multiline comment should end with whitespace Open
**/
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */
Multiline comment should end with whitespace Open
**/
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */
File should terminate with exactly one newline character ('\n') Open
- Read upRead up
- Exclude checks
terminating-newline
Verify that source files terminate with exactly one \n
character. This ensures that the last line of the file is valid according to the POSIX standard. Also see No Newline at End of File for more information.
Swift source files should terminate with exactly 1 \n
character, not 0 nor more than 1.
Preferred
let myConstant = 42¬
<eof></eof>
Not Preferred
let myConstant = 42<eof></eof>
let myConstant = 42¬
¬
¬
<eof></eof>
Single-line comment should start with whitespace Open
//// Telemetry Service
- Read upRead up
- Exclude checks
comment-whitespace
Prefer at least one whitespace character after a comment opening symbol (//
, ///
, /*
, or /**
) and at least one whitespace character before a comment closing symbol (*/
).
Preferred
// This is a comment
/// This is a documentation comment
/* This is a
multi-line comment */
/* This is a
multi-line comment
*/
/** This is a
documentation multi-line
comment
*/
Not Preferred
//This is a comment
///This is a documentation comment
/*This is a
multi-line comment*/
/**This is a multi-line
documentation comment */