Coder Social home page Coder Social logo

textdatabuilder's People

Contributors

orwel avatar vernou avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

anyxleo

textdatabuilder's Issues

Tag need parse parameters

A tag has the structure @{PrototypeName Parameter1=Value1, Parameter2="Value2"}.

We need to evolve the tag class to parse parameter.

  • Tag can't have parameter.
  • the first parameter begin after prototype's name, separate by blank character.
  • Parameters are separate by ','.
  • Parameter'name is alpha numeric [a-z][a-Z][0-9].
  • Other character in the name throw error.
  • Parameter have a value.
  • Parameter's name and parameter's are separated by '='.
  • Value can have all characters.
  • Value is closed by ',' or blank character.
  • If value contains ',' or blank character, it encapsulate by '"' ("My value with space")

For example :
@{Prototype1 Parameter1=Value1, Parameter2="Value 2"}
@{Prototype2 Parameter1 = Value1 , Parameter2 = "Value 2" }
@{Prototype3 Paths = "C:\Temp\Folder 1,C:\Temp\Folder 2"}

Prototype Parameter Value
MyPrototype1 Parameter1 Value1
Parameter2 Value 2
MyPrototype2 Parameter1 Value1
Parameter2 Value 2
MyPrototype3 Paths C:\Temp\Folder 1,C:\Temp\Folder 2

Add configuration to VS Code

We need a configuration to use VS Code.

  • Run debugger with .NET Core
  • Explore and run tests with the extension .NET Core Test Explorer

Print a template that contains only raw text

A template is text that describe how generate the text data.

First, the template is raw text and the generated text will be a copy of raw text.
For example :

This is the text of template.
Maybe a second line.

Result :

This is the text of template.
Maybe a second line.

Prototype CSV

We need to add a prototype CSV.

Example :
My.csv

Value1,Value2,Valu3
Value4,Value5,Valu6

Template.txt

@{CSV Path="My.csv"}
Column 1 : {0}, Column 2 : {1}, Column 3 : {0}
@{EndCSV}

Result

Column 1 : Value1, Column 2 : Value2, Column 3 : Value3
Column 1 : Value4, Column 2 : Value5, Column 3 : Value6

Add code coverage in the GitHub Actions Workflow

We need follow the code coverage evolution.

  • Add task in the workflow to compute the code coverage.
  • If the coverage is under 80%, then the commit status is fail.
  • Export the result to Codecov

Use 'Data tag' in 'Content tag'

We need to add the possibility to use 'Data tag' in 'Content tag'.
Example :

{CSV Path="file.csv"}
{0}, @{RandomInterger Min=27 Max=42}, {2}, @{Text Raw="End"}
{/CSV}

file.csv

Val1,Val2,Val3
Val4,Val5,Val6
Val7,Val8,Val9

Result :

Val1, 32, Val3, End
Val3, 37, Val6, End
Val7, 29, Val9, End

Add three examples of template

We need to add three examples of template to demonstrate how use the program :

  • Generate text with some random datas
  • Generate SQL insert from CSV data
  • Generate CSV from CSV (add/move/delete column)

Correct Codecov settings to pull request #39 have in success status

The rule is :

If the commit has code coverage equal or greater than 80% then
   the commit has the success status
else
   the commit has the fail status

But the pull request #39 have 85.51% coverage and has the fail status :
image

We need to disable the Path Status from Codecov :
https://docs.codecov.io/docs/commit-status#section-patch-status

Example of Codecov settings where the Path Status is disable :
https://github.com/junit-team/junit5/blob/f681af72f8d4c97bc61d5643c6f43f1d313b629b/.codecov.yml

The example "random_number.txt" don't work

If you execute :
..\sources\TextDataBuilder\bin\Debug\netcoreapp3.0\TextDataBuilder.exe .\random_number.txt
Result :

Unhandled exception. System.InvalidOperationException: Expected ',' between parameters.
   at TextDataBuilder.Parser.Tag.ParseParameters(Browser browser) in .\sources\TextDataBuilder\Parser\Tag.cs:line 58
   at TextDataBuilder.Parser.Tag.Parse(String text) in .\sources\TextDataBuilder\Parser\Tag.cs:line 24
   at TextDataBuilder.Parser.Tag.<>c__DisplayClass1_0.<.ctor>b__0() in .\sources\TextDataBuilder\Parser\Tag.cs:line 14
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at TextDataBuilder.Parser.Tag.get_Name() in .\sources\TextDataBuilder\Parser\Tag.cs:line 17
   at TextDataBuilder.Parser.TemplateParser.ParseTag(Browser browser) in .\sources\TextDataBuilder\Parser\TemplateParser.cs:line 54
   at TextDataBuilder.Parser.TemplateParser.Parse(Browser browser) in .\sources\TextDataBuilder\Parser\TemplateParser.cs:line 37
   at TextDataBuilder.Program.Main(String[] args) in .\sources\TextDataBuilder\Program.cs:line 21

Add Tag's Alias

All tag can have the parameter 'As'. This parameter is to distinguish tag based on the same prototype.

Example :

I am @{RandomInteger As=MyAge, Min=15, Max=20}.
My sister is  @{RandomInteger As=SisterAge, Min=25, Max=30}

Parse console's argument

The first argument is the template file path.

  1. Get template file path from the first argument
  2. Load template file
  3. Parse the template
  4. Build the text data
  5. Display the result in the console

Parse Tag to CSV prototype

We need to parse a tag to prototype CSV.

Example :
My.csv

Value1,Value2,Valu3
Value4,Value5,Valu6

Template.txt

@{CSV Path="My.csv"}
Column 1 : {0}, Column 2 : {1}, Column 3 : {2}
@{EndCSV}

Result

Column 1 : Value1, Column 2 : Value2, Column 3 : Value3
Column 1 : Value4, Column 2 : Value5, Column 3 : Value6

Configure GitHub Actions

On pull request and push :

  1. Build the solution TextDataBuilder
  2. Run the unit tests project TextDataBuilder.UnitTests

Tag to Tag's Alias

The tag's parameter As make a alias to the tag.
It is then possible to add a tag with the name of the alias to reprint the value generated by the precedent tag.

Example :

I am @{RandomInteger As=Age, Min=10, Max=20}.
At @{Age}, we can do a lot of thing.

End tag like HTML

Actually, end tag is 'End' + tag's name.
We want end tag like HTML, '/' + tag's name.

it's more succinct syntax.

Example with CSV tag :
My.csv

Value1,Value2,Valu3
Value4,Value5,Valu6

Template.txt

@{CSV Path="My.csv"}
Column 1 : {0}, Column 2 : {1}, Column 3 : {0}
@{/CSV}

Result

Column 1 : Value1, Column 2 : Value2, Column 3 : Value3
Column 1 : Value4, Column 2 : Value5, Column 3 : Value6

Prototype to display random integer

Add a prototype to display a random integer.

Name : Random integer
Parameters :

Name Type Required Default
Min Integer No 0
Max Integer No int.MaxValue

Refresh the tests discovered don't work with VS Code

When we add/rename/remove a test, the refresh action don't work on the text explorer.
The refresh fail with the error :

Error running command extension.refreshObjectExplorerNode: 
    command  extension.refreshObjectExplorerNode' not found. 
This is likely caused by the extension that contributes extension.refreshObjectExplorerNode.

Actually, we need restart VS Code to refresh the tests discovered.

Add Codecov settings

The pull request #30 is in fail status because default Codecov settings are not suitable for the project.
We need add Codecov settings to success pull request commit when the code coverage is equal or greater than 80%.

Add tag parser

A tag is characters will be replaced by generated text. It has the structure @{PrototypeName}.

  • Detect Tab
  • Begin with "@{"
  • End with "}"
  • Retrieve the name of prototype
  • Begin by the first no blank character after "@{"
  • End by blank character
  • The name is alpha numeric [a-z][a-Z][0-9]
  • Other character in the name throw error.

Initialize the solution

  • Create the solution : TextDataBuilder
  • Create and add to the solution the .NET Core Console project : TextDataBuilder
  • Create and add to the solution the xunit .NET Core project : TextDataBuilder.UnitTests

Add to CSV protertype the parameter 'Join'

We need to add the parameter Join to prototype CSV.

Join is string to put at the end each line, except in the last line.

Example :
My.csv

Value1,Value2,Value3
Value4,Value5,Value6
Value7,Value8,Value9

Template.txt

INSERT INTO MyTable (Col1, Col2, Col3)
VALUES
@{CSV Path="My.csv" Join=","}
({0}, {1}, {2})
@{/CSV}

Result

INSERT INTO MyTable (Col1, Col2, Col3)
VALUES
(Value1, Value2, Value3),
(Value4, Value5, Value6),
(Value7, Value8, Value9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.