Sha256: 7b9195534cda099edd8cf82987f03d2387dab57d6562fece37985f1a57f5578d

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

# Unreachable Code (`UnreachableCode`)

This check detects and ensures that you do not accidentally write code that will never be executed because it is unreachable.

## Examples

The following examples show code snippets that either fail or pass this check:

### ✗ Incorrect Code Example (Avoid using this):

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

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

### ✓ Correct Code Example (Use this instead):

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

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

## Configuration Options

The default configuration for this check:

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

## Disabling This Check

Disabling this check is not recommended.

## 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

2 entries across 2 versions & 1 rubygems

Version Path
platformos-check-0.4.14 docs/checks/unreachable_code.md
platformos-check-0.4.13 docs/checks/unreachable_code.md