Skip to content

Commit

Permalink
Idl lint in ci (#22635)
Browse files Browse the repository at this point in the history
* Add lint step for IDLs in workflows, ensure lint can be run with act

* Remove default value for an external array in chef zap files

* Ran zap regen for chef stuff

* Bootstrap and checkout so that idl script can run, added issues on todo

* Set container for lints: we need some packages installed for checkout submodules and bootstrap to work

* Fix comment on how to act-execute the lints

* Add space before ] for propper scripting

* Replace == with = in script

* Add more exceptions for the idl linter. virtually all chef files are broken

* Use python3 instead of python for check_includes.py

Co-authored-by: Andrei Litvin <andreilitvin@google.com>
  • Loading branch information
2 people authored and pull[bot] committed Oct 31, 2023
1 parent 1241c34 commit c66e702
Show file tree
Hide file tree
Showing 38 changed files with 117 additions and 54 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,78 @@ jobs:
runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build:0.5.99

steps:
- uses: Wandalen/wretry.action@v1.0.15
if: ${{ !env.ACT }}
name: Checkout
with:
action: actions/checkout@v3
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000
# To use act like:
# act -j code-lints
#
# Note you likely still need to have non submodules setup for the
# local machine, like:
# git submodule deinit --all
- uses: actions/checkout@v3
if: ${{ env.ACT }}
name: Checkout (ACT for local build)

# Bootstrap and checkout for internal scripts (like idl_lint)
# to run
- name: Checkout submodules
run: scripts/checkout_submodules.py --shallow --platform linux
- name: Bootstrap
timeout-minutes: 10
run: scripts/build/gn_bootstrap.sh

- name: Check for matter lint errors
if: always()
run: |
for idl_file in $(find . -name '*.matter'); do
# TODO: all these conformance failures should be fixed
# Issues exist for most of them:
# https://github.com/project-chip/connectedhomeip/issues/19180
# https://github.com/project-chip/connectedhomeip/issues/19176
# https://github.com/project-chip/connectedhomeip/issues/19175
# https://github.com/project-chip/connectedhomeip/issues/19173
# https://github.com/project-chip/connectedhomeip/issues/19169
# https://github.com/project-chip/connectedhomeip/issues/22640
if [ "$idl_file" = './examples/all-clusters-app/all-clusters-common/all-clusters-app.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter' ]; then continue; fi
if [ "$idl_file" = './examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter' ]; then continue; fi
if [ "$idl_file" = './examples/lighting-app/lighting-common/lighting-app.matter' ]; then continue; fi
if [ "$idl_file" = './examples/log-source-app/log-source-common/log-source-app.matter' ]; then continue; fi
if [ "$idl_file" = './examples/placeholder/linux/apps/app1/config.matter' ]; then continue; fi
if [ "$idl_file" = './examples/placeholder/linux/apps/app2/config.matter' ]; then continue; fi
if [ "$idl_file" = './examples/thermostat/thermostat-common/thermostat.matter' ]; then continue; fi
if [ "$idl_file" = './examples/window-app/common/window-app.matter' ]; then continue; fi
./scripts/run_in_build_env.sh "./scripts/idl_lint.py --log-level warn $idl_file" >/dev/null || exit 1
done
- name: Check broken links
# On-push disabled until the job can run fully green
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -7293,4 +7293,4 @@
"deviceIdentifier": 257
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -6121,4 +6121,4 @@
"deviceIdentifier": 21
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -7293,4 +7293,4 @@
"deviceIdentifier": 257
}
]
}
}
2 changes: 1 addition & 1 deletion examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -8993,4 +8993,4 @@
"deviceIdentifier": 10
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -6169,4 +6169,4 @@
"deviceIdentifier": 774
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -7989,4 +7989,4 @@
"deviceIdentifier": 768
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -6169,4 +6169,4 @@
"deviceIdentifier": 775
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -6185,4 +6185,4 @@
"deviceIdentifier": 262
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -6297,4 +6297,4 @@
"deviceIdentifier": 263
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -7293,4 +7293,4 @@
"deviceIdentifier": 256
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -7293,4 +7293,4 @@
"deviceIdentifier": 259
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ endpoint 0 {
}

server cluster LocalizationConfiguration {
callback attribute supportedLocales default = en-US;
callback attribute supportedLocales;
ram attribute featureMap;
ram attribute clusterRevision default = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "en-US",
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -6969,4 +6969,4 @@
"deviceIdentifier": 266
}
]
}
}
Loading

0 comments on commit c66e702

Please sign in to comment.