Skip to content

Commit aacf443

Browse files
authored
Update Linting and buggy files (#48)
Added linting Added missing files fixed typos
1 parent a4429a4 commit aacf443

16 files changed

+603
-574
lines changed

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Declare files that will always have CRLF line endings on checkout.
5+
*.cls text eol=crlf
6+
*.frm text eol=crlf
7+
*.bas text eol=crlf
8+
9+
# Denote all files that are truly binary and should not be modified.
10+
*.frx binary

.github/workflows/lint_vba.yml

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,21 @@ jobs:
1111
name: Test and Static Analysis
1212
runs-on: ubuntu-latest
1313
strategy:
14+
fail-fast: false
1415
matrix:
15-
php: ['8.2']
16+
python-version: ["3.11"]
1617

1718
steps:
18-
- name: Set up PHP
19-
uses: shivammathur/setup-php@v2
20-
with:
21-
php-version: ${{ matrix.php }}
22-
tools: composer:v2
23-
24-
- name: Set up Node
25-
uses: actions/setup-node@v1
26-
with:
27-
node-version: '14.x'
28-
29-
- name: Checkout code
30-
uses: actions/checkout@v2
31-
with:
32-
fetch-depth: 0
33-
34-
- name: Setup PHP Code Sniffer
35-
run: |
36-
composer require --no-install --no-update beakerboy/vba_tokenizer:dev-master
37-
composer config repositories.beakerboy vcs https://github.com/Beakerboy/VBA_Tokenizer
38-
composer update
39-
- name: Lint
40-
run: |
41-
vendor/bin/phpcs --extensions=cls/vba,bas/vba,frm/vba --standard=vendor/beakerboy/vba_tokenizer/src/Standards/VBA src/Modules
42-
vendor/bin/phpcs --extensions=cls/vba,bas/vba,frm/vba --standard=vendor/beakerboy/vba_tokenizer/src/Standards/VBA src/ClassModules
43-
vendor/bin/phpcs --extensions=cls/vba,bas/vba,frm/vba --standard=vendor/beakerboy/vba_tokenizer/src/Standards/VBA src/Forms
19+
- uses: actions/checkout@v3
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install antlr4-tools
27+
wget https://raw.githubusercontent.com/Beakerboy/VBA_Tokenizer/ANTLR/VbaLint
28+
chmod +x VbaLint
29+
- name: Lint with antlr
30+
run: |
31+
./VbaLint

.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/Beakerboy/VBA-SQL-Library.svg?branch=master)](https://travis-ci.org/Beakerboy/VBA-SQL-Library)
1+
[![Lint VBA](https://github.com/Beakerboy/VBA-SQL-Library/actions/workflows/lint_vba.yml/badge.svg?branch=master)](https://github.com/Beakerboy/VBA-SQL-Library/actions/workflows/lint_vba.yml)
22
<a href="https://beakerboy.github.io/VBA-SQL-Library/"><img src="https://img.shields.io/badge/code-documented-green.svg"/></a>
33

44
VBA SQL Library

deploy.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/ClassModules/SQLRecordset.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ Public Function iSQLRecordset_GetRows(num As Integer)
3939
iSQLRecordset_GetRows = orst.GetRows(num)
4040
End Function
4141

42-
Public Property iSQLRecordset_EOF()
42+
Property Get iSQLRecordset_EOF()
4343
iSQLRecordset_EOF = orst.EOF
44-
End Function
44+
End Property

src/ClassModules/iSQLRecordset.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ Public Function State()
3737
End Function
3838

3939
' Property: EOF
40-
Public Property EOF()
40+
Property Get EOF()
4141

4242
End Property

src/Forms/Login.frm

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
VERSION 5.00
2-
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Login
3-
Caption = "Please Log In"
4-
ClientHeight = 1920
5-
ClientLeft = 120
6-
ClientTop = 465
7-
ClientWidth = 2295
8-
OleObjectBlob = "Login.frx":0000
9-
StartUpPosition = 1 'CenterOwner
10-
End
11-
Attribute VB_Name = "Login"
12-
Attribute VB_GlobalNameSpace = False
13-
Attribute VB_Creatable = False
14-
Attribute VB_PredeclaredId = True
15-
Attribute VB_Exposed = False
16-
Public Ready As Boolean
17-
18-
Private Sub Form_Load()
19-
Me.Show
20-
Ready = False
21-
Call Wait
22-
'Label1.Visible = True
23-
End Sub
24-
25-
Public Function Wait()
26-
Do While Ready = False
27-
DoEvents
28-
Loop
29-
End Function
30-
31-
Private Sub LoginButton_Click()
32-
Ready = True
33-
Me.Hide
34-
End Sub
1+
VERSION 5.00
2+
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Login
3+
Caption = "Please Log In"
4+
ClientHeight = 1920
5+
ClientLeft = 120
6+
ClientTop = 465
7+
ClientWidth = 2295
8+
OleObjectBlob = "Login.frx":0000
9+
StartUpPosition = 1 'CenterOwner
10+
End
11+
Attribute VB_Name = "Login"
12+
Attribute VB_GlobalNameSpace = False
13+
Attribute VB_Creatable = False
14+
Attribute VB_PredeclaredId = True
15+
Attribute VB_Exposed = False
16+
Public Ready As Boolean
17+
18+
Private Sub Form_Load()
19+
Me.Show
20+
Ready = False
21+
Call Wait
22+
'Label1.Visible = True
23+
End Sub
24+
25+
Public Function Wait()
26+
Do While Ready = False
27+
DoEvents
28+
Loop
29+
End Function
30+
31+
Private Sub LoginButton_Click()
32+
Ready = True
33+
Me.Hide
34+
End Sub

testing/ClassModules/SQLTestRecordset.cls

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ Public Function iSQLRecordset_GetValue(MyFieldname)
2727
iSQLRecordset_GetValue = sQuery
2828
End Function
2929

30+
Public Function iSQLRecordset_GetRows(num As Integer)
31+
iSQLRecordset_GetRows = num
32+
End Function
33+
34+
Property Get iSQLRecordset_EOF()
35+
iSQLRecordset_EOF = False
36+
End Property
37+
Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
1-
VERSION 1.0 CLASS
2-
BEGIN
3-
MultiUse = -1 'True
4-
END
5-
Attribute VB_Name = "SQLlibDatabaseTests"
6-
Attribute VB_GlobalNameSpace = False
7-
Attribute VB_Creatable = False
8-
Attribute VB_PredeclaredId = False
9-
Attribute VB_Exposed = False
10-
Implements iTestCase
11-
12-
Dim MyDatabase As SQLDatabase
13-
Dim MyRecordset As New SQLTestRecordset
14-
Dim MyConnection As New SQLTestConnection
15-
Dim SimpleInsert As SQLInsert
16-
Dim TestCase As iTestCase
17-
18-
' Constructor: Class_Initialize
19-
' Initialize class members
20-
Private Sub Class_Initialize()
21-
Set TestCase = CreateTestCase()
22-
End Sub
23-
24-
Sub iTestCase_Setup()
25-
Set MyDatabase = Create_SQLDatabase()
26-
27-
With MyDatabase
28-
.DSN = "mydsn"
29-
.Password = "Pa$$word"
30-
.Username = "myusername"
31-
Set .Recordset = MyRecordset
32-
Set .Connection = MyConnection
33-
End With
34-
35-
36-
Set SimpleInsert = Create_SQLInsert
37-
With SimpleInsert
38-
.Table = "users"
39-
.Fields = Array("id")
40-
.Values = Array(1)
41-
End With
42-
End Sub
43-
44-
Sub iTestCase_TearDown()
45-
46-
End Sub
47-
48-
Function mssqlTest()
49-
MyDatabase.DBType = "mssql"
50-
51-
Actual = MyDatabase.InsertGetNewId(SimpleInsert)
52-
Expected = "SET NOCOUNT ON;INSERT INTO users (id) VALUES (1);SELECT SCOPE_IDENTITY() as somethingunique"
53-
mssqlTest = AssertEquals(Actual, Expected)
54-
End Function
55-
56-
Function psqlTest()
57-
MyDatabase.DBType = "psql"
58-
59-
Actual = MyDatabase.InsertGetNewId(SimpleInsert, "id")
60-
Expected = "INSERT INTO users (id) VALUES (1) RETURNING id"
61-
psqlTest = AssertEquals(Actual, Expected)
62-
63-
End Function
64-
65-
' Sub: iTestCase_RunTest
66-
' Run a specific test.
67-
Public Sub iTestCase_RunTest(Test As String, Optional clsObj = Nothing)
68-
TestCase.RunTest Test, Me
69-
End Sub
70-
71-
' Sub: iTestCase_RunAllTests
72-
' Run all tests.
73-
Public Sub iTestCase_RunAllTests(Optional ByVal clsObj = Nothing)
74-
TestCase.RunAllTests Me
75-
End Sub
1+
VERSION 1.0 CLASS
2+
BEGIN
3+
MultiUse = -1 'True
4+
END
5+
Attribute VB_Name = "SQLlibDatabaseTests"
6+
Attribute VB_GlobalNameSpace = False
7+
Attribute VB_Creatable = False
8+
Attribute VB_PredeclaredId = False
9+
Attribute VB_Exposed = False
10+
Implements iTestCase
11+
12+
Dim MyDatabase As SQLDatabase
13+
Dim MyRecordset As New SQLTestRecordset
14+
Dim MyConnection As New SQLTestConnection
15+
Dim SimpleInsert As SQLInsert
16+
Dim TestCase As iTestCase
17+
18+
' Constructor: Class_Initialize
19+
' Initialize class members
20+
Private Sub Class_Initialize()
21+
Set TestCase = CreateTestCase()
22+
End Sub
23+
24+
Sub iTestCase_Setup()
25+
Set MyDatabase = Create_SQLDatabase()
26+
27+
With MyDatabase
28+
.DSN = "mydsn"
29+
.Password = "Pa$$word"
30+
.Username = "myusername"
31+
Set .Recordset = MyRecordset
32+
Set .Connection = MyConnection
33+
End With
34+
35+
36+
Set SimpleInsert = Create_SQLInsert
37+
With SimpleInsert
38+
.Table = "users"
39+
.Fields = Array("id")
40+
.Values = Array(1)
41+
End With
42+
End Sub
43+
44+
Sub iTestCase_TearDown()
45+
46+
End Sub
47+
48+
Function mssqlTest()
49+
MyDatabase.DBType = "mssql"
50+
51+
Actual = MyDatabase.InsertGetNewId(SimpleInsert)
52+
Expected = "SET NOCOUNT ON;INSERT INTO users (id) VALUES (1);SELECT SCOPE_IDENTITY() as somethingunique"
53+
mssqlTest = AssertEquals(Actual, Expected)
54+
End Function
55+
56+
Function psqlTest()
57+
MyDatabase.DBType = "psql"
58+
59+
Actual = MyDatabase.InsertGetNewId(SimpleInsert, "id")
60+
Expected = "INSERT INTO users (id) VALUES (1) RETURNING id"
61+
psqlTest = AssertEquals(Actual, Expected)
62+
63+
End Function
64+
65+
' Sub: iTestCase_RunTest
66+
' Run a specific test.
67+
Public Sub iTestCase_RunTest(Test As String, Optional clsObj = Nothing)
68+
TestCase.RunTest Test, Me
69+
End Sub
70+
71+
' Sub: iTestCase_RunAllTests
72+
' Run all tests.
73+
Public Sub iTestCase_RunAllTests(Optional ByVal clsObj = Nothing)
74+
TestCase.RunAllTests Me
75+
End Sub

0 commit comments

Comments
 (0)