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

Show Line Numbers for ValidateRelativeLink function #942

Open
gortok opened this issue Jan 16, 2021 · 1 comment
Open

Show Line Numbers for ValidateRelativeLink function #942

gortok opened this issue Jan 16, 2021 · 1 comment
Labels
General Enhancement New feature or request

Comments

@gortok
Copy link

gortok commented Jan 16, 2021

During link validation for a .cshtml file (Razor); I noted that it would tell me the location of the file it couldn't validate, but not the line number:

[INFO] ========== Analyzer Results ==========
[WARN] [C:/Users/George/src/doubleyourproductivity/DypGenerator/input/corporate.cshtml => corporate.html] Could not validate relative link: <link rel="stylesheet" href="../css/bulma-divider.min.css"> (ValidateR                                                    elativeLinks)
[WARN] [C:/Users/George/src/doubleyourproductivity/DypGenerator/input/corporate.cshtml => corporate.html] Could not validate relative link: <a class="navbar-item is-size-5 has-text-weight-semibold" href="/free"                                                    >
                                        Free Content
                                </a> (ValidateRelativeLinks)
[WARN] [C:/Users/George/src/doubleyourproductivity/DypGenerator/input/index.cshtml => index.html] Could not validate relative link: <a class="navbar-item is-size-5 has-text-weight-semibold" href="/free">
                                        Free Content
                                </a> (ValidateRelativeLinks)
[WARN] [C:/Users/George/src/doubleyourproductivity/DypGenerator/input/paid.cshtml => paid.html] Could not validate relative link: <link rel="stylesheet" href="../css/bulma-divider.min.css"> (ValidateRelativeLin                                                    ks)
[WARN] [C:/Users/George/src/doubleyourproductivity/DypGenerator/input/paid.cshtml => paid.html] Could not validate relative link: <a class="navbar-item is-size-5 has-text-weight-semibold" href="/free">
                                        Free Content
                                </a> (ValidateRelativeLinks)
[WARN] 5 total relative links could not be validated (ValidateRelativeLinks)
[INFO] ========== Completed ==========
[INFO] Finished execution in 3860 ms
[INFO] Cleaned temp directory C:/Users/George/src/doubleyourproductivity/DypGenerator/temp

gjstocker@dor MINGW64 ~/src/doubleyourproductivity/DypGenerator (1-statiq-netily-migration)

Recommend that the line number is included in the ValidateRelativeLink function, for ease of finding the line for the error.

@daveaglick daveaglick added the General Enhancement New feature or request label Jan 19, 2021
@daveaglick
Copy link
Member

Excellent idea! I'm going to need to think about implementation a bit though because the line number in the file doesn't necessarily line up with what the Razor engine sees due to stripping out front matter. My first thought is that there are actually a bunch of places where knowing that offset could be valuable for debugging - perhaps a universal ContentOffset value inside the IContentProvider might work well here 🤔. Then any logging that needs to be done relative to line numbers can add the offset to get the real line number of the file on disk (and any modules that remove content can increment it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Enhancement New feature or request
Development

No branches or pull requests

2 participants