
from linter import run_linters, RegexpLinter

linters = [
    RegexpLinter(r'ASSERT\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'ASSERT2\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'#ifdef\s+',
                 message='`#if defined(x)` is preferred to `#ifdef x`'),
    RegexpLinter(r'#if\s+defined\s+',
                 message='`#if defined(x)` is preferred to `#if defined x`'),
    RegexpLinter(r'#ifndef\s+',
                 message='`#if !defined(x)` is preferred to `#ifndef x`'),
]

if __name__ == '__main__':
    run_linters(linters)


from linter import run_linters, RegexpLinter

linters = [
    RegexpLinter(r'WARN\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'ASSERT\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'ASSERT2\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'#ifdef\s+',
                 message='`#if defined(x)` is preferred to `#ifdef x`'),
    RegexpLinter(r'#if\s+defined\s+',
                 message='`#if defined(x)` is preferred to `#if defined x`'),
    RegexpLinter(r'#ifndef\s+',
                 message='`#if !defined(x)` is preferred to `#ifndef x`'),
]

if __name__ == '__main__':
    run_linters(linters)

Check for WARN macro with space separating it from its paren
linters: Check for WARN macro with space separating it from its paren

  
  from linter import run_linters, RegexpLinter
  
  linters = [
+     RegexpLinter(r'WARN\s+\(',
+                  message='CPP macros should not have a space between the macro name and their argument list'),
      RegexpLinter(r'ASSERT\s+\(',
                   message='CPP macros should not have a space between the macro name and their argument list'),
      RegexpLinter(r'ASSERT2\s+\(',
                   message='CPP macros should not have a space between the macro name and their argument list'),
      RegexpLinter(r'#ifdef\s+',
                   message='`#if defined(x)` is preferred to `#ifdef x`'),
      RegexpLinter(r'#if\s+defined\s+',
                   message='`#if defined(x)` is preferred to `#if defined x`'),
      RegexpLinter(r'#ifndef\s+',
                   message='`#if !defined(x)` is preferred to `#ifndef x`'),
  ]
  
  if __name__ == '__main__':
      run_linters(linters)
  
Check for WARN macro with space separating it from its paren
## Code Before:

from linter import run_linters, RegexpLinter

linters = [
    RegexpLinter(r'ASSERT\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'ASSERT2\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'#ifdef\s+',
                 message='`#if defined(x)` is preferred to `#ifdef x`'),
    RegexpLinter(r'#if\s+defined\s+',
                 message='`#if defined(x)` is preferred to `#if defined x`'),
    RegexpLinter(r'#ifndef\s+',
                 message='`#if !defined(x)` is preferred to `#ifndef x`'),
]

if __name__ == '__main__':
    run_linters(linters)

## Instruction:
Check for WARN macro with space separating it from its paren
## Code After:

from linter import run_linters, RegexpLinter

linters = [
    RegexpLinter(r'WARN\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'ASSERT\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'ASSERT2\s+\(',
                 message='CPP macros should not have a space between the macro name and their argument list'),
    RegexpLinter(r'#ifdef\s+',
                 message='`#if defined(x)` is preferred to `#ifdef x`'),
    RegexpLinter(r'#if\s+defined\s+',
                 message='`#if defined(x)` is preferred to `#if defined x`'),
    RegexpLinter(r'#ifndef\s+',
                 message='`#if !defined(x)` is preferred to `#ifndef x`'),
]

if __name__ == '__main__':
    run_linters(linters)
