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

Linting on files with syntax errors #1

Closed
ostreifel opened this issue Jan 15, 2018 · 4 comments
Closed

Linting on files with syntax errors #1

ostreifel opened this issue Jan 15, 2018 · 4 comments

Comments

@ostreifel
Copy link
Contributor

I noticed that if even one line of the file has a syntax error the whole file will be ommitted from linting checks.

@dougwilson
Copy link
Contributor

dougwilson commented Jan 15, 2018

I believe this is the same behavior as other linters like eslint for javascript. If the parser is unable to parse the file, I'm not sure how it would be able to lint it. Any thoughts on a possible solution?

@ostreifel
Copy link
Contributor Author

Currently the visitor checks for errors but I think it should just check if the fragment is not null.

namespace TSQLLint.Tests.UnitTests.Parser
{
    using System.IO;
    using NUnit.Framework;
    using TSQLLint.Lib.Parser;

    [TestFixture]
    public class FragmentBuilderTests
    {
        [Test]
        public void TestError()
        {
            var file = new StringReader(@"
                CREATE PROCEDURE proc1
                    ,@param1 NVARCHAR(someConst) = null;
                AS
                return 0;
");
            var builder = new FragmentBuilder();
            var fragment = builder.GetFragment(file, out var errors);
            Assert.AreNotEqual(0, errors.Count);
            Assert.NotNull(fragment);
        }
    }
}

@dougwilson
Copy link
Contributor

Oh, I see, you're saying it would br some kind of change to the C# lib, not the extension, haha. I was super confused. So the repo and code for the lib is https://github.com/tsqllint/tsqllint if you want to open an issue (but a PR is even more ideal) 👍

@ostreifel
Copy link
Contributor Author

Ok thanks, will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants