Skip to content

Commit 86bfaa3

Browse files
committed
Merge branch 'master' into RGP-localization
* master: Fix workflow names chore: autopublish 2024-01-31T02:13:19Z fix tie.lua issue exposed by de-linting. (Note to RGP: The Tie Mover test case "V2-across-system-Fin27.musx" illustrates the bug that this change fixes.) chore: autopublish 2024-01-27T17:31:36Z Put back references to mixin Update staff_rename.lua Fix for mixin_helper Ignore warning in tie.lua for now Fixes for globals with RetainLuaState via FCXCustomLuaWindow Fix issues with unused variables Luacheck hinting and fixes Add linting workflow and config # Conflicts: # src/transpose_chromatic.lua
2 parents 66e3ab5 + 6830280 commit 86bfaa3

337 files changed

Lines changed: 5719 additions & 6617 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and deploy scripts/docs
1+
name: Build and optionally deploy scripts/docs
22

33
on:
44
push:

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Lint all src files
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- "master"
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
- name: Luacheck linter
16+
uses: lunarmodules/luacheck@v1

.luacheckrc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-- luacheck: ignore 131
2+
include_files = { "src/**/*.lua"}
3+
exclude_files = {
4+
"mobdebug.lua",
5+
"src/lunajson/**/*.lua",
6+
}
7+
globals = {
8+
"finale",
9+
"finenv",
10+
"finaleplugin",
11+
"coll2table",
12+
"dumpproperties",
13+
"each",
14+
"eachbackwards",
15+
"eachcell",
16+
"eachentry",
17+
"eachentrysaved",
18+
"eachstaff",
19+
"loadall",
20+
"loadallforregion",
21+
"pairsbykeys",
22+
"bit32",
23+
"utf8",
24+
"socket",
25+
"tinyxml2",
26+
"xmlelements",
27+
"xmlattributes",
28+
"prettyformatjson",
29+
"plugindef"
30+
}
31+
codes = true
32+
ignore = {
33+
"6..", -- formatting
34+
"131/plugindef" -- ignore plugindef errors; seems to be needed just for VS Code
35+
}
36+
allow_defined_top = true

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"recommendations": ["Koihik.vscode-lua-format", "sumneko.lua"]
2+
"recommendations": ["Koihik.vscode-lua-format", "sumneko.lua", "rog2.luacheck"]
33
}

.vscode/recommended_settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"dist/**": true
3030
},
3131
"editor.formatOnSave": true,
32+
"Lua.diagnostics.enable": false,
3233
"Lua.diagnostics.disable": [
3334
"lowercase-global",
3435
"luadoc-miss-cate-name"

dist/UI_switch_to_selected_part.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ package.preload["library.general_library"] = package.preload["library.general_li
267267
function library.get_page_format_prefs()
268268
local current_part = library.get_current_part()
269269
local page_format_prefs = finale.FCPageFormatPrefs()
270-
local success = false
270+
local success
271271
if current_part:IsScore() then
272272
success = page_format_prefs:LoadScore()
273273
else
@@ -370,7 +370,7 @@ package.preload["library.general_library"] = package.preload["library.general_li
370370
local str = finale.FCString()
371371
local min_width = 160
372372

373-
function format_ctrl(ctrl, h, w, st)
373+
local function format_ctrl(ctrl, h, w, st)
374374
ctrl:SetHeight(h)
375375
ctrl:SetWidth(w)
376376
if st then
@@ -379,11 +379,11 @@ package.preload["library.general_library"] = package.preload["library.general_li
379379
end
380380
end
381381

382-
title_width = string.len(title) * 6 + 54
382+
local title_width = string.len(title) * 6 + 54
383383
if title_width > min_width then
384384
min_width = title_width
385385
end
386-
text_width = string.len(text) * 6
386+
local text_width = string.len(text) * 6
387387
if text_width > min_width then
388388
min_width = text_width
389389
end
@@ -508,7 +508,7 @@ function plugindef()
508508
finaleplugin.NoStore = true
509509
finaleplugin.Author = "CJ Garcia"
510510
finaleplugin.Copyright = "© 2022 CJ Garcia Music"
511-
finaleplugin.Version = "1.3"
511+
finaleplugin.Version = "1.3.1"
512512
finaleplugin.Date = "February 14, 2022"
513513
finaleplugin.CategoryTags = "UI"
514514
finaleplugin.HashURL = "https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/UI_switch_to_selected_part.hash"
@@ -532,8 +532,8 @@ function ui_switch_to_selected_part()
532532
part_ID = part:GetID()
533533

534534
local found_staff = false
535-
local part = finale.FCPart(part_ID)
536-
part:SwitchTo()
535+
local this_part = finale.FCPart(part_ID)
536+
this_part:SwitchTo()
537537
local systems = finale.FCStaffSystems()
538538
systems:LoadAll()
539539
local system = systems:FindMeasureNumber(top_cell.Measure)
@@ -542,7 +542,7 @@ function ui_switch_to_selected_part()
542542
staves:LoadAllForItem(system.ItemNo)
543543
found_staff = staves:FindStaff(top_cell.Staff) ~= nil
544544
end
545-
part:SwitchBack()
545+
this_part:SwitchBack()
546546
if found_staff then break end
547547
end
548548
end

dist/accidental_simplify.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ package.preload["library.configuration"] = package.preload["library.configuratio
317317
end
318318

319319
function configuration.get_parameters(file_name, parameter_list)
320-
local path = ""
320+
local path
321321
if finenv.IsRGPLua then
322322
path = finenv.RunningLuaFolderPath()
323323
else
@@ -425,7 +425,7 @@ package.preload["library.note_entry"] = package.preload["library.note_entry"] or
425425

426426
function note_entry.get_top_note_position(entry, entry_metrics)
427427
local retval = -math.huge
428-
local loaded_here = false
428+
local loaded_here
429429
entry_metrics, loaded_here = use_or_get_passed_in_entry_metrics(entry, entry_metrics)
430430
if nil == entry_metrics then
431431
return retval
@@ -449,7 +449,7 @@ package.preload["library.note_entry"] = package.preload["library.note_entry"] or
449449

450450
function note_entry.get_bottom_note_position(entry, entry_metrics)
451451
local retval = math.huge
452-
local loaded_here = false
452+
local loaded_here
453453
entry_metrics, loaded_here = use_or_get_passed_in_entry_metrics(entry, entry_metrics)
454454
if nil == entry_metrics then
455455
return retval
@@ -498,11 +498,11 @@ package.preload["library.note_entry"] = package.preload["library.note_entry"] or
498498
if entry:CalcStemUp() then
499499
return 0
500500
end
501-
local left, right = note_entry.calc_widths(entry)
501+
local left, _ = note_entry.calc_widths(entry)
502502
return -left
503503
end
504504

505-
function note_entry.calc_left_of_primary_notehead(entry)
505+
function note_entry.calc_left_of_primary_notehead()
506506
return 0
507507
end
508508

@@ -527,7 +527,7 @@ package.preload["library.note_entry"] = package.preload["library.note_entry"] or
527527
if not entry:CalcStemUp() then
528528
return 0
529529
end
530-
local left, right = note_entry.calc_widths(entry)
530+
local left, _ = note_entry.calc_widths(entry)
531531
return left
532532
end
533533

@@ -898,7 +898,7 @@ package.preload["library.transposition"] = package.preload["library.transpositio
898898
local curr_disp = note.Displacement
899899
local curr_alt = note.RaiseLower
900900
local key = get_key(note)
901-
local number_of_steps, diatonic_steps, fifth_steps = get_key_info(key)
901+
local _, diatonic_steps, _ = get_key_info(key)
902902
local interval_normalized = signed_modulus(interval, #diatonic_steps)
903903
local steps_in_alteration = calc_steps_in_alteration(key, interval, alteration)
904904
local steps_in_interval = calc_steps_in_normalized_interval(key, interval_normalized)

dist/articulation_autoposition_rolled_chords.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ package.preload["library.note_entry"] = package.preload["library.note_entry"] or
3535

3636
function note_entry.get_top_note_position(entry, entry_metrics)
3737
local retval = -math.huge
38-
local loaded_here = false
38+
local loaded_here
3939
entry_metrics, loaded_here = use_or_get_passed_in_entry_metrics(entry, entry_metrics)
4040
if nil == entry_metrics then
4141
return retval
@@ -59,7 +59,7 @@ package.preload["library.note_entry"] = package.preload["library.note_entry"] or
5959

6060
function note_entry.get_bottom_note_position(entry, entry_metrics)
6161
local retval = math.huge
62-
local loaded_here = false
62+
local loaded_here
6363
entry_metrics, loaded_here = use_or_get_passed_in_entry_metrics(entry, entry_metrics)
6464
if nil == entry_metrics then
6565
return retval
@@ -108,11 +108,11 @@ package.preload["library.note_entry"] = package.preload["library.note_entry"] or
108108
if entry:CalcStemUp() then
109109
return 0
110110
end
111-
local left, right = note_entry.calc_widths(entry)
111+
local left, _ = note_entry.calc_widths(entry)
112112
return -left
113113
end
114114

115-
function note_entry.calc_left_of_primary_notehead(entry)
115+
function note_entry.calc_left_of_primary_notehead()
116116
return 0
117117
end
118118

@@ -137,7 +137,7 @@ package.preload["library.note_entry"] = package.preload["library.note_entry"] or
137137
if not entry:CalcStemUp() then
138138
return 0
139139
end
140-
local left, right = note_entry.calc_widths(entry)
140+
local left, _ = note_entry.calc_widths(entry)
141141
return left
142142
end
143143

@@ -339,7 +339,6 @@ package.preload["library.articulation"] = package.preload["library.articulation"
339339
top_pos = math.floor(((10000 * top_pos) / cell_metrics.StaffScaling) + 0.5)
340340
return curr_pos.Y >= top_pos
341341
end
342-
return false
343342
end
344343

345344
function articulation.calc_main_character_dimensions(artic_def)
@@ -456,7 +455,7 @@ function articulation_autoposition_rolled_chords()
456455
artic.Visible = false
457456
else
458457
local this_bottom = note_entry.get_bottom_note_position(entry)
459-
staff_scale = mm.StaffScaling / 10000
458+
local staff_scale = mm.StaffScaling / 10000
460459
top_page_pos = top_page_pos / staff_scale
461460
bottom_page_pos = bottom_page_pos / staff_scale
462461
left_page_pos = left_page_pos / staff_scale

dist/articulation_delete_duplicates.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ function articulation_delete_duplicates()
1717
end
1818
local sort_list = {}
1919
local unique_list = {}
20-
for k,v in ipairs(art_list) do
20+
for _, v in ipairs(art_list) do
2121
if (not sort_list[v]) then
2222
unique_list[#unique_list + 1] = v
2323
sort_list[v] = true
2424
end
2525
end
26-
for key, value in pairs(art_list) do
26+
for _, _ in pairs(art_list) do
2727
for a in each(arts) do
2828
a:DeleteData()
2929
end
3030
end
31-
for key, value in pairs(unique_list) do
31+
for _, value in pairs(unique_list) do
3232
local art = finale.FCArticulation()
3333
art:SetNoteEntry(note_entry)
3434
art:SetID(value) art:SaveNew()

0 commit comments

Comments
 (0)