diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml new file mode 100644 index 0000000..4fa690b --- /dev/null +++ b/.github/workflows/code-style.yml @@ -0,0 +1,27 @@ +name: code-style + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.1 + + luacheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y lua-check + + - name: Check Lua Files + run: luacheck import-theme/ diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 524f04f..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [main] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.1 diff --git a/import-theme/osm-feature-info/init.lua b/import-theme/osm-feature-info/init.lua index 029fe99..71a5888 100644 --- a/import-theme/osm-feature-info/init.lua +++ b/import-theme/osm-feature-info/init.lua @@ -1,7 +1,5 @@ -local themepark = ... local theme = {} - function theme.has_area_tags(tags) if tags.area == 'yes' then return true diff --git a/import-theme/osm-feature-info/topics/geography_tables.lua b/import-theme/osm-feature-info/topics/geography_tables.lua index c37bf83..b74e0f9 100644 --- a/import-theme/osm-feature-info/topics/geography_tables.lua +++ b/import-theme/osm-feature-info/topics/geography_tables.lua @@ -1,4 +1,4 @@ -local themepark, theme, cfg = ... +local themepark, theme = ... themepark:set_option('srid', 4326) @@ -24,7 +24,7 @@ themepark:add_table{ tiles = false } -themepark:add_proc('node', function(object, data) +themepark:add_proc('node', function(object) themepark:insert('geom_nodes', { geog = object:as_point() }, object.tags) @@ -51,9 +51,9 @@ themepark:add_table{ tiles = false } -themepark:add_proc('way', function(object, data) +themepark:add_proc('way', function(object) - attributes = {} + local attributes if object.is_closed and theme.has_area_tags(object.tags) then attributes = { geog = object:as_polygon() @@ -87,7 +87,7 @@ themepark:add_table{ }}, tiles = false } -themepark:add_proc('relation', function(object, data) +themepark:add_proc('relation', function(object) local relation_type = object:grab_tag('type') local geog