Skip to content

Commit

Permalink
Fix Werror handling in build script (#7562)
Browse files Browse the repository at this point in the history
# About the pull request

This PR partially ports
tgstation/tgstation#83015 fixing warnings not
getting treated as errors due to a regex error. We want Werror to catch
common things like unused variables in CI testing.

Removes an unused squad var causing warnings.

# Explain why it's good for the game

More robust code

# Testing Photographs and Procedure
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->

<!-- !! If you are modifying sprites, you **must** include one or more
in-game screenshots or videos of the new sprites. !! -->


https://github.com/cmss13-devs/cmss13/actions/runs/11770975974/job/32784168250?pr=7562

# Changelog
No player facing changes.
  • Loading branch information
Drulikar authored Nov 12, 2024
1 parent 5e32075 commit e0ef326
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion code/datums/factions/upp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/datum/faction/upp/modify_hud_holder(image/holder, mob/living/carbon/human/H)
var/hud_icon_state
var/obj/item/card/id/ID = H.get_idcard()
var/datum/squad/squad = H.assigned_squad
var/_role
if(H.mind)
_role = H.job
Expand Down
20 changes: 12 additions & 8 deletions tools/build/lib/byond.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,18 @@ export const DreamMaker = async (dmeFile, options = {}) => {
testOutputFile(`${dmeBaseName}.rsc`);
const runWithWarningChecks = async (dmPath, args) => {
const execReturn = await Juke.exec(dmPath, args);
const ignoredWarningCodes = options.ignoreWarningCodes ?? [];
const reg =
ignoredWarningCodes.length > 0
? new RegExp(`\d+:warning: (?!(${ignoredWarningCodes.join("|")}))`)
: /\d+:warning: /;
if (options.warningsAsErrors && execReturn.combined.match(reg)) {
Juke.logger.error(`Compile warnings treated as errors`);
throw new Juke.ExitCode(2);
if(options.warningsAsErrors){
const ignoredWarningCodes = options.ignoreWarningCodes ?? [];
if(ignoredWarningCodes.length > 0 ){
Juke.logger.info('Ignored warning codes:', ignoredWarningCodes.join(', '));
}
const base_regex = '\\d+:warning( \\([a-z_]*\\))?:'
const with_ignores = `\\d+:warning( \\([a-z_]*\\))?:(?!(${ignoredWarningCodes.map(x => `.*${x}.*$`).join('|')}))`
const reg = ignoredWarningCodes.length > 0 ? new RegExp(with_ignores, "m") : new RegExp(base_regex,"m")
if (options.warningsAsErrors && execReturn.combined.match(reg)) {
Juke.logger.error(`Compile warnings treated as errors`);
throw new Juke.ExitCode(2);
}
}
return execReturn;
};
Expand Down

0 comments on commit e0ef326

Please sign in to comment.