Sha256: 7f55db6fa20f90e37157a3c3572913df1169baa35d13dfec3dcd16ebdcb0820d

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

# Unreachable code (`UnreachableCode`)

Unreachable code reports code that will never be reached, no matter what.

## Check Details

This check is aimed at ensuring you will not accidentally write code that will never be reached.

:-1: Examples of **incorrect** code for this check:

```liquid
  assign x = "hello"
  break
  log x
```

```liquid
  if x
    log x
  else
    break
    log "Stop"
  endif
```

:+1: Examples of **correct** code for this check:

```liquid
  assign x = "hello"
  log x
  break
```

```liquid
  if x
    log x
  else
    log "Stop"
    break
  endif
```

## Check Options

The default configuration for this check is the following:

```yaml
UnreachableCode:
  enabled: true
```

## When Not To Use It

There should be no cases where disabling this rule is needed.

## Version

This check has been introduced in PlatformOS Check 0.4.7.

## Resources

- [Rule Source][codesource]
- [Documentation Source][docsource]

[codesource]: /lib/platformos_check/checks/unreachable_code.rb
[docsource]: /docs/checks/unreachable_code.md

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
platformos-check-0.4.12 docs/checks/unreachable_code.md
platformos-check-0.4.11 docs/checks/unreachable_code.md
platformos-check-0.4.10 docs/checks/unreachable_code.md
platformos-check-0.4.9 docs/checks/unreachable_code.md
platformos-check-0.4.8 docs/checks/unreachable_code.md
platformos-check-0.4.7 docs/checks/unreachable_code.md