Skip to content

Commit

Permalink
Add script to check for tabs in IDFs
Browse files Browse the repository at this point in the history
  • Loading branch information
Myoldmopar committed Sep 10, 2019
1 parent 9d1b750 commit 75ffa2e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions .decent_ci-Linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ compilers:
- ./scripts/dev/verify_file_encodings.py
- ./scripts/dev/validate_idd_units.py
- ./scripts/dev/find_byref_bool_override.py
- ./scripts/dev/check_for_tabs_in_idfs.py

- name: "gcc"
version: "7.4"
Expand Down
34 changes: 34 additions & 0 deletions scripts/dev/check_for_tabs_in_idfs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python

import io
import json
import os


def usage():
print("""This script verifies that the idf files in the testfiles directory don't have tab characters.""")


current_script_dir = os.path.dirname(os.path.realpath(__file__))
test_files_dir = os.path.join(current_script_dir, '..', '..', 'testfiles')

for root, dirs, files in os.walk(test_files_dir):
for sfile in files:
if sfile.endswith('.idf') or sfile.endswith('.imf'):
if root == test_files_dir:
relative_path = sfile
else:
folder = os.path.basename(os.path.normpath(root))
relative_path = os.path.join(folder, sfile)
abs_path = os.path.join(test_files_dir, relative_path)
with io.open(abs_path, 'r', encoding='utf-8', errors='strict') as fd:
for i, line in enumerate(fd):
if '\t' in line:
print(json.dumps({
'tool': 'check_for_tabs_in_idfs',
'filename': os.path.join('testfiles', relative_path),
'file': os.path.join('testfiles', relative_path),
'line': i,
'messagetype': 'error',
'message': 'Tab character found in IDF, use spaces for indentation'
}))
2 changes: 1 addition & 1 deletion testfiles/BasicsFiles/Exercise1A.idf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
! Environment: Chicago, IL, USA, Summer and Winter design days
!
!

c
Version,9.2;

!- =========== ALL OBJECTS IN CLASS: BUILDING ===========
Expand Down

6 comments on commit 75ffa2e

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoolingTowerPlantComponent (Myoldmopar) - x86_64-MacOS-10.13-clang: OK (2552 of 2553 tests passed, 4 test warnings)

Messages:\n

  • 4 tests had: ERR diffs.

Failures:\n

integration Test Summary

  • Passed: 669
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoolingTowerPlantComponent (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2592 of 2593 tests passed, 4 test warnings)

Messages:\n

  • 4 tests had: ERR diffs.

Failures:\n

integration Test Summary

  • Passed: 672
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoolingTowerPlantComponent (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

Build Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoolingTowerPlantComponent (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-custom_check: Build Failed

Build Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoolingTowerPlantComponent (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1215 of 1215 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoolingTowerPlantComponent (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (672 of 673 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 672
  • Failed: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.