|
|
0a978746e1
|
Fix all Credo issues
Resolves 26 Credo warnings/issues:
Code Readability (2 issues):
- Break long line in mac_address.ex (line 316 > 120 chars)
- Break long @spec in agents.ex (line 332 > 120 chars)
Refactoring Opportunities (2 issues):
- Reduce cyclomatic complexity in device_live/form.ex
- Extract helper functions to simplify SNMPv3 credential resolution
- Split logic into smaller, focused functions
- Reduce nesting depth in snmp_oid.ex
- Extract nested logic into separate helper functions
Warnings (22 issues):
- Fix comparison warning in validator.ex
- Split validate_sensor_value/1 into separate clauses for int/float
- Add credo directive for valid NaN check (value != value)
- Replace 21 expensive length/1 checks with Enum.empty?/1
- Change assertions from `assert length(list) >= 1` to `refute Enum.empty?(list)`
- Change assertions from `assert length(list) > 0` to `refute Enum.empty?(list)`
- Affected files: device_poller_worker_test.exs, mib_test.exs,
snmp_tokenizer_test.exs, parser_test.exs, error_test.exs, compiler_test.exs
All tests passing (5578 tests, 0 failures).
Credo now reports: "found no issues"
|
2026-02-06 10:31:09 -06:00 |
|
|
|
055bef4cd7
|
Add comprehensive tests for MIB module (45 tests)
Create new test file for MIB facade module with tests for:
- compile/2 (16 tests) - file paths, all options, error handling
- compile_string/2 (11 tests, @tag :yecc_required) - MIB content parsing
- load_compiled/1 (7 tests) - loading compiled MIB files
- compile_all/2 (13 tests) - batch compilation with dependency order
- Option validation (3 tests) - handling invalid option keys
- Return value structure (4 tests) - tuple format verification
- Error handling (4 tests) - graceful handling of invalid inputs
- Default options (3 tests) - behavior with and without options
Tests verify proper delegation to Compiler module and
correct error handling for file operations.
Note: compile_string tests tagged with :yecc_required since
they depend on yecc parser generator being available.
Coverage: 1,419 → 1,464 tests, 45 passing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-06 09:01:49 -06:00 |
|