Add plt print command for purple playlists#886
Conversation
| "path/filepath" | ||
| "testing" | ||
|
|
||
| _ "modernc.org/sqlite" |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
import 'modernc.org/sqlite' is not allowed from list 'Main' (depguard)
| "path/filepath" | ||
| "strings" | ||
|
|
||
| _ "modernc.org/sqlite" // registers the pure-Go "sqlite" database/sql driver |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
import 'modernc.org/sqlite' is not allowed from list 'Main' (depguard)
| `INSERT INTO TagMap VALUES (3, 1, 3, 2)`, | ||
| `INSERT INTO TagMap VALUES (4, 1, 4, 3)`, | ||
|
|
||
| `INSERT INTO Location VALUES (1, NULL, NULL, 1102016935, 135, 'sjj', 420, 0)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Duplicate words (NULL,) found (dupword)
| `INSERT INTO TagMap VALUES (4, 1, 4, 3)`, | ||
|
|
||
| `INSERT INTO Location VALUES (1, NULL, NULL, 1102016935, 135, 'sjj', 420, 0)`, | ||
| `INSERT INTO Location VALUES (2, 23, 5, NULL, NULL, 'nwt', 420, 0)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Duplicate words (NULL,) found (dupword)
|
|
||
| `INSERT INTO Location VALUES (1, NULL, NULL, 1102016935, 135, 'sjj', 420, 0)`, | ||
| `INSERT INTO Location VALUES (2, 23, 5, NULL, NULL, 'nwt', 420, 0)`, | ||
| `INSERT INTO Location VALUES (4, NULL, NULL, 1112024040, 1, NULL, 420, 3)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Duplicate words (NULL,) found (dupword)
| } | ||
|
|
||
| func TestSniffPlaylist_UnverifiedSchemaProceeds(t *testing.T) { | ||
| path := writePlaylistFixture(t, fixtureOptions{schemaVersion: 99}) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.fixtureOptions is missing fields omitTables, omitManifest, notZip, corruptDB, databaseName (exhaustruct)
| // fixtureSchema returns CREATE statements for every table except those omitted. | ||
| func fixtureSchema(omit map[string]bool) []string { | ||
| tables := map[string]string{ | ||
| "Tag": `CREATE TABLE Tag (TagId INTEGER PRIMARY KEY, Name TEXT, Type INTEGER)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string Tag has 3 occurrences, make it a constant (goconst)
| func fixtureSchema(omit map[string]bool) []string { | ||
| tables := map[string]string{ | ||
| "Tag": `CREATE TABLE Tag (TagId INTEGER PRIMARY KEY, Name TEXT, Type INTEGER)`, | ||
| "TagMap": `CREATE TABLE TagMap (TagMapId INTEGER PRIMARY KEY, TagId INTEGER, PlaylistItemId INTEGER, Position INTEGER)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string TagMap has 3 occurrences, make it a constant (goconst)
| tables := map[string]string{ | ||
| "Tag": `CREATE TABLE Tag (TagId INTEGER PRIMARY KEY, Name TEXT, Type INTEGER)`, | ||
| "TagMap": `CREATE TABLE TagMap (TagMapId INTEGER PRIMARY KEY, TagId INTEGER, PlaylistItemId INTEGER, Position INTEGER)`, | ||
| "PlaylistItem": `CREATE TABLE PlaylistItem (PlaylistItemId INTEGER PRIMARY KEY, Label TEXT, StartTrimOffsetTicks INTEGER, EndTrimOffsetTicks INTEGER, EndAction INTEGER, ThumbnailFilePath TEXT)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string PlaylistItem has 3 occurrences, make it a constant (goconst)
| "Tag": `CREATE TABLE Tag (TagId INTEGER PRIMARY KEY, Name TEXT, Type INTEGER)`, | ||
| "TagMap": `CREATE TABLE TagMap (TagMapId INTEGER PRIMARY KEY, TagId INTEGER, PlaylistItemId INTEGER, Position INTEGER)`, | ||
| "PlaylistItem": `CREATE TABLE PlaylistItem (PlaylistItemId INTEGER PRIMARY KEY, Label TEXT, StartTrimOffsetTicks INTEGER, EndTrimOffsetTicks INTEGER, EndAction INTEGER, ThumbnailFilePath TEXT)`, | ||
| "PlaylistItemLocationMap": `CREATE TABLE PlaylistItemLocationMap (PlaylistItemId INTEGER, LocationId INTEGER, MajorMultimediaType INTEGER, BaseDurationTicks INTEGER)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string PlaylistItemLocationMap has 3 occurrences, make it a constant (goconst)
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestResolveLanguage missing the call to method parallel in test Run (paralleltest)
Line 59 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestSlugify missing the call to method parallel (paralleltest)
Line 78 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestSlugify missing the call to method parallel in test Run (paralleltest)
Line 93 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestUniqueSlug missing the call to method parallel (paralleltest)
Line 103 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestParsePlaylist_NameAndOrder missing the call to method parallel (paralleltest)
Line 36 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestParsePlaylist_PubTrackItem missing the call to method parallel (paralleltest)
Line 52 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestParsePlaylist_BibleItemMarkers missing the call to method parallel (paralleltest)
Line 72 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestParsePlaylist_ImageCue missing the call to method parallel (paralleltest)
Line 92 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestParsePlaylist_DocidItem missing the call to method parallel (paralleltest)
Line 109 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestDescribeSource missing the call to method parallel (paralleltest)
Line 52 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestDescribeSource missing the call to method parallel in test Run (paralleltest)
Line 80 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildPrintView missing the call to method parallel (paralleltest)
Line 89 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderJSON_RoundTrips missing the call to method parallel (paralleltest)
Line 122 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderText_ContainsKeyData missing the call to method parallel (paralleltest)
Line 139 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_AcceptsValidRenamedFile missing the call to method parallel (paralleltest)
Line 22 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_Rejections missing the call to method parallel (paralleltest)
Line 39 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestSniffPlaylist_Rejections missing the call to method parallel in test Run (paralleltest)
Line 51 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_UnverifiedSchemaProceeds missing the call to method parallel (paralleltest)
Line 69 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
integer-format: fmt.Sprintf can be replaced with faster strconv.Itoa (perfsprint)
Line 211 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
parameter name 'p' is too short for the scope of its usage (varnamelen)
Line 86 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'it' is too short for the scope of its usage (varnamelen)
Line 123 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'it' is too short for the scope of its usage (varnamelen)
Line 208 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'zw' is too short for the scope of its usage (varnamelen)
Line 122 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'db' is too short for the scope of its usage (varnamelen)
Line 159 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
parameter name 'id' is too short for the scope of its usage (varnamelen)
Line 40 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 57 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 76 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'r' is too short for the scope of its usage (varnamelen)
Line 79 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'zr' is too short for the scope of its usage (varnamelen)
Line 146 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
parameter name 'a' is too short for the scope of its usage (varnamelen)
Line 190 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'db' is too short for the scope of its usage (varnamelen)
Line 191 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'it' is too short for the scope of its usage (varnamelen)
Line 255 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'm' is too short for the scope of its usage (varnamelen)
Line 359 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'f' is too short for the scope of its usage (varnamelen)
Line 374 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'rc' is too short for the scope of its usage (varnamelen)
Line 399 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'rc' is too short for the scope of its usage (varnamelen)
Line 434 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'db' is too short for the scope of its usage (varnamelen)
Line 457 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
variable name 'pl' is too short for the scope of its usage (varnamelen)
Line 37 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 58 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
Line 77 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
Line 90 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 139 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 147 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 217 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 221 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
anonymous switch statements should never be cuddled (wsl)
Line 61 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 112 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 288 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 378 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 482 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 27 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 45 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 82 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 76 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (too many statements above range) (wsl_v5)
Line 111 in fbf96f6
🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (invalid statement above assign) (wsl_v5)
Line 227 in fbf96f6
| "TagMap": `CREATE TABLE TagMap (TagMapId INTEGER PRIMARY KEY, TagId INTEGER, PlaylistItemId INTEGER, Position INTEGER)`, | ||
| "PlaylistItem": `CREATE TABLE PlaylistItem (PlaylistItemId INTEGER PRIMARY KEY, Label TEXT, StartTrimOffsetTicks INTEGER, EndTrimOffsetTicks INTEGER, EndAction INTEGER, ThumbnailFilePath TEXT)`, | ||
| "PlaylistItemLocationMap": `CREATE TABLE PlaylistItemLocationMap (PlaylistItemId INTEGER, LocationId INTEGER, MajorMultimediaType INTEGER, BaseDurationTicks INTEGER)`, | ||
| "Location": `CREATE TABLE Location (LocationId INTEGER PRIMARY KEY, BookNumber INTEGER, ChapterNumber INTEGER, DocumentId INTEGER, Track INTEGER, KeySymbol TEXT, MepsLanguage INTEGER, Type INTEGER)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string Location has 3 occurrences, make it a constant (goconst)
| "PlaylistItem": `CREATE TABLE PlaylistItem (PlaylistItemId INTEGER PRIMARY KEY, Label TEXT, StartTrimOffsetTicks INTEGER, EndTrimOffsetTicks INTEGER, EndAction INTEGER, ThumbnailFilePath TEXT)`, | ||
| "PlaylistItemLocationMap": `CREATE TABLE PlaylistItemLocationMap (PlaylistItemId INTEGER, LocationId INTEGER, MajorMultimediaType INTEGER, BaseDurationTicks INTEGER)`, | ||
| "Location": `CREATE TABLE Location (LocationId INTEGER PRIMARY KEY, BookNumber INTEGER, ChapterNumber INTEGER, DocumentId INTEGER, Track INTEGER, KeySymbol TEXT, MepsLanguage INTEGER, Type INTEGER)`, | ||
| "IndependentMedia": `CREATE TABLE IndependentMedia (IndependentMediaId INTEGER PRIMARY KEY, OriginalFilename TEXT, FilePath TEXT, MimeType TEXT, Hash TEXT)`, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string IndependentMedia has 3 occurrences, make it a constant (goconst)
| "IndependentMedia": `CREATE TABLE IndependentMedia (IndependentMediaId INTEGER PRIMARY KEY, OriginalFilename TEXT, FilePath TEXT, MimeType TEXT, Hash TEXT)`, | ||
| "PlaylistItemIndependentMediaMap": `CREATE TABLE PlaylistItemIndependentMediaMap ` + | ||
| `(PlaylistItemId INTEGER, IndependentMediaId INTEGER, DurationTicks INTEGER)`, | ||
| "PlaylistItemMarker": `CREATE TABLE PlaylistItemMarker (PlaylistItemMarkerId INTEGER PRIMARY KEY, ` + |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string PlaylistItemMarker has 5 occurrences, make it a constant (goconst)
| // requiredTables are the database tables the parser depends on. Their presence | ||
| // is the contract that lets us read a playlist regardless of schema version. | ||
| var requiredTables = []string{ | ||
| "Tag", |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string Tag has 3 occurrences, make it a constant (goconst)
| // is the contract that lets us read a playlist regardless of schema version. | ||
| var requiredTables = []string{ | ||
| "Tag", | ||
| "TagMap", |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
string TagMap has 3 occurrences, make it a constant (goconst)
| } | ||
|
|
||
| dbPath := filepath.Join(tmpDir, "userData.db") | ||
| if err := os.WriteFile(dbPath, data, 0o600); err != nil { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Magic number: 0o600, in detected (mnd)
| b.WriteRune(r) | ||
| } | ||
| prevHyphen = true | ||
| continue |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
continue with no blank line before (nlreturn)
| "testing" | ||
| ) | ||
|
|
||
| func TestTicksToSeconds(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestTicksToSeconds missing the call to method parallel (paralleltest)
| {"image cue 4s", 40000000, 4.0}, | ||
| } | ||
|
|
||
| for _, tc := range cases { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestTicksToSeconds missing the call to method parallel in test Run (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestResolveLanguage(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestResolveLanguage missing the call to method parallel (paralleltest)
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_AcceptsValidRenamedFile missing the call to method parallel (paralleltest)
Line 22 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_Rejections missing the call to method parallel (paralleltest)
Line 39 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestSniffPlaylist_Rejections missing the call to method parallel in test Run (paralleltest)
Line 51 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_UnverifiedSchemaProceeds missing the call to method parallel (paralleltest)
Line 69 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
integer-format: fmt.Sprintf can be replaced with faster strconv.Itoa (perfsprint)
Line 236 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
parameter name 'p' is too short for the scope of its usage (varnamelen)
Line 82 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'it' is too short for the scope of its usage (varnamelen)
Line 148 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'it' is too short for the scope of its usage (varnamelen)
Line 233 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'zw' is too short for the scope of its usage (varnamelen)
Line 122 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'db' is too short for the scope of its usage (varnamelen)
Line 159 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
parameter name 'id' is too short for the scope of its usage (varnamelen)
Line 40 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 57 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'b' is too short for the scope of its usage (varnamelen)
Line 76 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'r' is too short for the scope of its usage (varnamelen)
Line 79 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'zr' is too short for the scope of its usage (varnamelen)
Line 146 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
parameter name 'a' is too short for the scope of its usage (varnamelen)
Line 190 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'db' is too short for the scope of its usage (varnamelen)
Line 191 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'it' is too short for the scope of its usage (varnamelen)
Line 255 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'm' is too short for the scope of its usage (varnamelen)
Line 359 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'f' is too short for the scope of its usage (varnamelen)
Line 374 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'rc' is too short for the scope of its usage (varnamelen)
Line 399 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'rc' is too short for the scope of its usage (varnamelen)
Line 434 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'db' is too short for the scope of its usage (varnamelen)
Line 457 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
variable name 'pl' is too short for the scope of its usage (varnamelen)
Line 37 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
Line 73 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
Line 86 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 164 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
Line 147 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 217 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 221 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
anonymous switch statements should never be cuddled (wsl)
Line 61 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 112 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 354 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 403 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 438 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 482 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 27 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 45 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 82 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 76 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (too many statements above range) (wsl_v5)
Line 111 in 1111b7d
🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (invalid statement above assign) (wsl_v5)
Line 227 in 1111b7d
| func checkPlaylistFile(path string) error { | ||
| if _, err := os.Stat(path); err != nil { | ||
| if errors.Is(err, os.ErrNotExist) { | ||
| return fmt.Errorf("no such file: %s", path) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("no such file: %s", path)" (err113)
|
|
||
| var pltPrintJSON bool | ||
|
|
||
| var pltCmd = &coral.Command{ |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
coral.Command is missing fields Aliases, SuggestFor, ValidArgs, ValidArgsFunction, Args, ArgAliases, BashCompletionFunction, Deprecated, Annotations, Version, PersistentPreRun, PersistentPreRunE, PreRun, PreRunE, Run, RunE, PostRun, PostRunE, PersistentPostRun, PersistentPostRunE, FParseErrWhitelist, CompletionOptions, TraverseChildren, Hidden, SilenceErrors, SilenceUsage, DisableFlagParsing, DisableAutoGenTag, DisableFlagsInUseLine, DisableSuggestions, SuggestionsMinimumDistance (exhaustruct)
| vbs plt build meeting.playlist`, | ||
| } | ||
|
|
||
| var pltPrintCmd = &coral.Command{ |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
coral.Command is missing fields Aliases, SuggestFor, ValidArgs, ValidArgsFunction, ArgAliases, BashCompletionFunction, Deprecated, Annotations, Version, PersistentPreRun, PersistentPreRunE, PreRun, PreRunE, RunE, PostRun, PostRunE, PersistentPostRun, PersistentPostRunE, FParseErrWhitelist, CompletionOptions, TraverseChildren, Hidden, SilenceErrors, SilenceUsage, DisableFlagParsing, DisableAutoGenTag, DisableFlagsInUseLine, DisableSuggestions, SuggestionsMinimumDistance (exhaustruct)
| view := printView{Name: pl.Name, Items: make([]printItem, 0, len(pl.Items))} | ||
|
|
||
| for _, it := range pl.Items { | ||
| pi := printItem{ |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.printItem is missing field Markers (exhaustruct)
| }{ | ||
| { | ||
| "pub track", | ||
| Item{Location: &Location{KeySymbol: "sjj", Track: 135, Type: 0}}, |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
cmd.Item is missing fields Position, PlaylistItemID, Label, StartTrimTicks, EndTrimTicks, EndAction, ThumbnailPath, Image, Markers (exhaustruct)
| } | ||
| } | ||
|
|
||
| func TestDescribeSource(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestDescribeSource missing the call to method parallel (paralleltest)
| }, | ||
| } | ||
|
|
||
| for _, tc := range cases { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestDescribeSource missing the call to method parallel in test Run (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestBuildPrintView(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestBuildPrintView missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestRenderJSON_RoundTrips(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderJSON_RoundTrips missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestRenderText_ContainsKeyData(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestRenderText_ContainsKeyData missing the call to method parallel (paralleltest)
statik
left a comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
golangci
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
Line 221 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
anonymous switch statements should never be cuddled (wsl)
Line 61 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 112 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 150 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 248 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Line 438 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
Line 482 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 27 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 45 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
Line 82 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
Line 29 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (too many statements above range) (wsl_v5)
Line 111 in b48cb2f
🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (invalid statement above assign) (wsl_v5)
Line 227 in b48cb2f
| } | ||
| } | ||
|
|
||
| func TestParsePlaylist_BookChapterMarkers(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestParsePlaylist_BookChapterMarkers missing the call to method parallel (paralleltest)
| "testing" | ||
| ) | ||
|
|
||
| func TestSniffPlaylist_AcceptsValidRenamedFile(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_AcceptsValidRenamedFile missing the call to method parallel (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestSniffPlaylist_Rejections(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_Rejections missing the call to method parallel (paralleltest)
| {"missing required table", fixtureOptions{omitTables: []string{"PlaylistItemMarker"}}, "PlaylistItemMarker"}, | ||
| } | ||
|
|
||
| for _, tc := range cases { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Range statement for test TestSniffPlaylist_Rejections missing the call to method parallel in test Run (paralleltest)
| } | ||
| } | ||
|
|
||
| func TestSniffPlaylist_UnverifiedSchemaProceeds(t *testing.T) { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
Function TestSniffPlaylist_UnverifiedSchemaProceeds missing the call to method parallel (paralleltest)
|
|
||
| // verifyTables confirms every required table is present in the database. | ||
| func verifyTables(dbPath string) error { | ||
| db, err := sql.Open("sqlite", dbPath) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
variable name 'db' is too short for the scope of its usage (varnamelen)
| } | ||
|
|
||
| func TestParsePlaylist_NameAndOrder(t *testing.T) { | ||
| pl := parseFixture(t) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
variable name 'pl' is too short for the scope of its usage (varnamelen)
| DurationSec: ticksToSeconds(m.DurationTicks), | ||
| }) | ||
| } | ||
| view.Items = append(view.Items, pi) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
| t.Helper() | ||
|
|
||
| img := image.NewRGBA(image.Rect(0, 0, 1, 1)) | ||
| var buf bytes.Buffer |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
declarations should never be cuddled (wsl)
| } | ||
|
|
||
| var stmts []string | ||
| for _, name := range order { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
ranges should only be cuddled with assignments used in the iteration (wsl)
| if it.IsImage() { | ||
| return ticksToSeconds(it.Image.DurationTicks) | ||
| } | ||
| if it.Location != nil { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
| if omit[name] { | ||
| continue | ||
| } | ||
| stmts = append(stmts, tables[name]) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
append only allowed to cuddle with appended value (wsl)
|
|
||
| for _, r := range s { | ||
| r = unicode.ToLower(r) | ||
| switch { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
anonymous switch statements should never be cuddled (wsl)
| uniqueSlug("other", seen), | ||
| } | ||
| want := []string{"talk", "talk-2", "talk-3", "other"} | ||
| for i := range want { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
| if err != nil { | ||
| return fmt.Errorf("could not open database: %w", err) | ||
| } | ||
| defer func() { _ = db.Close() }() |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
| if len(pl.Items) != 4 { | ||
| t.Fatalf("len(Items) = %d, want 4", len(pl.Items)) | ||
| } | ||
| for i, it := range pl.Items { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
| t.Fatalf("chapter markers = %d, want 3", len(chapter.Markers)) | ||
| } | ||
| wantLabels := []string{"Marker one", "Marker two", "Marker three"} | ||
| for i, want := range wantLabels { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before range statement (wsl)
| if err != nil { | ||
| t.Fatalf("unverified schema version should still parse, got: %v", err) | ||
| } | ||
| t.Cleanup(func() { _ = arc.Close() }) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
expressions should not be cuddled with blocks (wsl)
| uniqueSlug("talk", seen), | ||
| uniqueSlug("other", seen), | ||
| } | ||
| want := []string{"talk", "talk-2", "talk-3", "other"} |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (too many statements above range) (wsl_v5)
| // queryPlaylistName returns the name of the playlist tag (Type 2). | ||
| func queryPlaylistName(db *sql.DB) (string, error) { | ||
| var name string | ||
| err := db.QueryRow(`SELECT Name FROM Tag WHERE Type = 2`).Scan(&name) |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
missing whitespace above this line (invalid statement above assign) (wsl_v5)
Parse purple playlist exports (ZIP + SQLite) and print their cues as a table or JSON, fully offline. Includes a content-based format sniffer that rejects invalid files with named reasons, a SQLite-to-domain parser for the verified table contract, and a synthetic fixture generator so tests never depend on real exports. Promotes modernc.org/sqlite to a direct dependency (pure-Go driver, no CGO) and adds a vendor-neutrality CI guard that rejects the publisher's identifiers in authored files.
… run Add an Examples section and a descriptive Use string so 'vbs plt --help' makes clear each subcommand takes a playlist file. Resolve relative input paths against BUILD_WORKING_DIRECTORY so 'bazel run' works from the directory the user invoked it in, not the runfiles tree.
A missing or unreadable path now fails with "Could not open playlist file: no such file" instead of the format-validation message, which was misleading for a mistyped path. Extracted openPlaylist as the shared resolve-check-sniff entry point for the print and build commands.
| files := map[string][]byte{ | ||
| dbName: dbBytes, | ||
| fixtureThumbA: onePixelJPEG(t), | ||
| fixtureThumbBook: onePixelJPEG(t), |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gci)
| } else { | ||
| err = renderText(os.Stdout, view) | ||
| } | ||
| if err != nil { |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
| if err != nil { | ||
| return fmt.Errorf("could not read embedded media: %w", err) | ||
| } | ||
| defer func() { _ = rows.Close() }() |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
| if err != nil { | ||
| return fmt.Errorf("could not list database tables: %w", err) | ||
| } | ||
| defer func() { _ = rows.Close() }() |
There was a problem hiding this comment.
🚫 [golangci] reported by reviewdog 🐶
only one cuddle assignment allowed before defer statement (wsl)
Summary
First phase of the
pltcommand group for working with purple playlistexports (a ZIP container holding a SQLite database, produced by the source
app for queuing media in live events).
This phase delivers
vbs plt print <playlist>, which parses a playlist andprints its cues offline — no media is downloaded.
rejects invalid files with a named reason (not a zip, missing manifest,
non-SQLite database, or missing required tables). Unverified schema
versions warn but proceed when the required tables are present.
items, published-media locations (pub/track, book/chapter, docid shapes), embedded
image cues, and segment markers.
plt printrenders an aligned table (position, label, source, duration,marker count, raw end action) with a
--jsonflag for the same data.manifest + 1×1 JPEGs) covering every source shape, so tests never depend on
real exports.
scripts/check-vendor-neutral.sh, wired intothe lint workflow) rejects the publisher's identifiers in authored files.
modernc.org/sqlite(pure-Go, no CGO) is promoted from an indirect to adirect dependency.
Test Plan
go test ./cmd/green (helpers, sniffer, parser, print; tickconversion, slugging, language resolution, all four source shapes)
bazel build //cmd:go_default_libraryandbazel test //cmd:go_default_testgreengofmt,go vet ./cmd/,go build ./...,go mod verifycleanacross 8 items, 1 image cue, correct source descriptions