Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report custom map rule errors in the lint output. #15252

Merged
merged 1 commit into from Jun 15, 2018

Conversation

Projects
None yet
3 participants
@pchote
Copy link
Member

pchote commented Jun 12, 2018

This PR exposes parse errors in custom map rules directly to the lint output instead of quietly falling back to the default mod rules and then failing other unrelated tests.

Fixes #14030.

Before:

Testing map: Fort Lonestar
OpenRA.Utility(1,1): Error: Map contains invalid custom rules.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
OpenRA.Utility(1,1): Error: Actor sniper.soviets is not defined by any rule.
Errors: 13

After:

Testing map: Fort Lonestar
OpenRA.Utility(1,1): Error: System.AggregateException: One or more errors occurred. ---> OpenRA.YamlException: Actor type world: Junk value `JunkValue` on trait node BrokenTrait
  at OpenRA.ActorInfo..ctor (OpenRA.ObjectCreator creator, System.String name, OpenRA.MiniYaml node) [0x000d5] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Ruleset+<Load>c__AnonStorey2.<>m__1 (OpenRA.MiniYamlNode k) [0x00016] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Exts.ToDictionaryWithConflictLog[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.String debugName, System.Func`2[T,TResult] logKey, System.Func`2[T,TResult] logValue) [0x00071] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Ruleset.MergeOrDefault[T] (System.String name, OpenRA.FileSystem.IReadOnlyFileSystem fileSystem, System.Collections.Generic.IEnumerable`1[T] files, OpenRA.MiniYaml additional, OpenRA.IReadOnlyDictionary`2[TKey,TValue] defaults, System.Func`2[T,TResult] makeObject, System.Func`2[T,TResult] filterNode) [0x0006a] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Ruleset+<Load>c__AnonStorey2.<>m__0 () [0x00001] in <c69711e2b30a429c9315af125e46b55c>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <bb7b695b8c6246b3ac1646577aea7650>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout) [0x00000] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at OpenRA.Ruleset.Load (OpenRA.ModData modData, OpenRA.FileSystem.IReadOnlyFileSystem fileSystem, System.String tileSet, OpenRA.MiniYaml mapRules, OpenRA.MiniYaml mapWeapons, OpenRA.MiniYaml mapVoices, OpenRA.MiniYaml mapNotifications, OpenRA.MiniYaml mapMusic, OpenRA.MiniYaml mapSequences, OpenRA.MiniYaml mapModelSequences) [0x000c2] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Map.PostInit () [0x00002] in <c69711e2b30a429c9315af125e46b55c>:0 
---> (Inner Exception #0) OpenRA.YamlException: Actor type world: Junk value `JunkValue` on trait node BrokenTrait
  at OpenRA.ActorInfo..ctor (OpenRA.ObjectCreator creator, System.String name, OpenRA.MiniYaml node) [0x000d5] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Ruleset+<Load>c__AnonStorey2.<>m__1 (OpenRA.MiniYamlNode k) [0x00016] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Exts.ToDictionaryWithConflictLog[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.String debugName, System.Func`2[T,TResult] logKey, System.Func`2[T,TResult] logValue) [0x00071] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Ruleset.MergeOrDefault[T] (System.String name, OpenRA.FileSystem.IReadOnlyFileSystem fileSystem, System.Collections.Generic.IEnumerable`1[T] files, OpenRA.MiniYaml additional, OpenRA.IReadOnlyDictionary`2[TKey,TValue] defaults, System.Func`2[T,TResult] makeObject, System.Func`2[T,TResult] filterNode) [0x0006a] in <c69711e2b30a429c9315af125e46b55c>:0 
  at OpenRA.Ruleset+<Load>c__AnonStorey2.<>m__0 () [0x00001] in <c69711e2b30a429c9315af125e46b55c>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <bb7b695b8c6246b3ac1646577aea7650>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <bb7b695b8c6246b3ac1646577aea7650>:0 <---

Errors: 1

Testcase: Break the rules in a custom map in an arbitrary way, then run the linter with and without this PR.

@pchote pchote added this to the Next release milestone Jun 12, 2018

@pchote pchote force-pushed the pchote:fix-custom-map-rule-linting branch from 9004a4c to 312ae7f Jun 12, 2018

@abcdefg30 abcdefg30 merged commit 4d664d4 into OpenRA:bleed Jun 15, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@abcdefg30

This comment has been minimized.

Copy link
Member

abcdefg30 commented Jun 15, 2018

@pchote pchote deleted the pchote:fix-custom-map-rule-linting branch Jul 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.