Skip to content

Commit

Permalink
Merge pull request #5 from philwalk/bugfix-01
Browse files Browse the repository at this point in the history
dependabot yaml moved
  • Loading branch information
philwalk authored Mar 26, 2024
2 parents fcc0bff + 2725695 commit 40102dc
Show file tree
Hide file tree
Showing 13 changed files with 851 additions and 17 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "scala-steward" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
4 changes: 3 additions & 1 deletion .github/workflows/dependency-graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ jobs:
- uses: actions/checkout@v3
- uses: scalacenter/sbt-dependency-submission@v2
with:
working-directory: .
## Optional: Define the working directory of your build.
## It should contain the build.sbt file.
working-directory: './'
configs-ignore: scala-doc-tool
6 changes: 5 additions & 1 deletion .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ name: Scala CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: write
contents: read

jobs:
build:
Expand All @@ -28,5 +30,7 @@ jobs:
- name: Run tests
run: sbt test
# Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository
# - name: Upload dependency graph
# - name: Sbt Dependency Submission
# uses: scalacenter/[email protected]

9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# pallet
Library for Cross-Platform Development

<img alt="pallet image" width=200 src="images/wooden-pallet.png">

### Library for Cross-Platform Development

![CI](https://github.com/philwalk/pallet/actions/workflows/scala.yml/badge.svg)

<img alt="pallet image" width=240 src="images/wooden-pallet.png">


Provides support for expressive idioms typical of scripting languages, for writing portable code that runs everywhere.

Expand Down
14 changes: 8 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//lazy val scala213 = "2.13.12"
lazy val scala213 = "2.13.13"
lazy val scala331 = "3.3.1"
lazy val scalaVer = scala331

Expand All @@ -9,7 +9,7 @@ javacOptions ++= Seq("-source", "11", "-target", "11")

//ThisBuild / envFileName := "dev.env" // sbt-dotenv plugin gets build environment here
ThisBuild / scalaVersion := scalaVer
ThisBuild / version := "0.10.8"
ThisBuild / version := "0.10.10"
ThisBuild / versionScheme := Some("semver-spec")

ThisBuild / organization := "org.vastblue"
Expand All @@ -20,6 +20,9 @@ ThisBuild / organizationHomepage := Some(url("https://vastblue.org"))

parallelExecution := false

Compile / packageBin / packageOptions +=
Package.ManifestAttributes(java.util.jar.Attributes.Name.CLASS_PATH -> "")

ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/philwalk/pallet"),
Expand Down Expand Up @@ -68,12 +71,11 @@ lazy val root = (project in file(".")).
)

libraryDependencies ++= Seq(
"org.simpleflatmapper" % "sfm-csv" % "8.2.3",
"org.simpleflatmapper" % "sfm-csv" % "9.0.0",
"com.github.sbt" % "junit-interface" % "0.13.3" % Test,
"org.scalatest" %% "scalatest" % "3.2.17" % Test,
"org.scalatest" %% "scalatest" % "3.2.18" % Test,
"io.github.chronoscala" %% "chronoscala" % "2.0.10",
"org.vastblue" % "unifile_3" % "0.3.1",
//"com.github.sisyphsu" % "dateparser" % "1.0.11",
"org.vastblue" % "unifile_3" % "0.3.2",
)

/*
Expand Down
2 changes: 2 additions & 0 deletions commaTest.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1st,2nd,3rd
A,B,C
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.8
sbt.version=1.9.9
1 change: 1 addition & 0 deletions project/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ThisBuild / scalaVersion := "2.12.19"
11 changes: 8 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
scalaVersion := "2.12.19"

val SONATYPE_VERSION = sys.env.getOrElse("SONATYPE_VERSION", "3.10.0") // "3.9.21")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.13")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")

//addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17")

addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.15")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % SONATYPE_VERSION)
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")

addDependencyTreePlugin
Expand Down
5 changes: 4 additions & 1 deletion src/main/scala/vastblue/examples/CsvWriteRead.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import vastblue.pallet.*

object CsvWriteRead {
def main(args: Array[String]): Unit = {
val testFiles = Seq("tabTest.csv", "commaTest.csv")

var testFiles = args.filter { _.path.isFile }.toSeq
if (testFiles.isEmpty) testFiles = Seq("tabTest.csv", "commaTest.csv")

for (filename <- testFiles) {
val testFile: Path = filename.toPath

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/vastblue/file/FastCsv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object FastCsv {
throw new java.nio.file.NoSuchFileException(s"${p.posx}")
}
val lines = readLines(p)
def autoDelimiter = autoDetectDelimiter(lines.take(20).mkString("\n"), p.toString, ignoreErrors = false)
def autoDelimiter = autoDetectDelimiter(lines.take(100).mkString("\n"), p.toString, ignoreErrors = false)
val aDelimiter = if (delimiter.nonEmpty) delimiter else autoDelimiter
val str = p.contentAsString
val reader = new StringReader(str)
Expand Down Expand Up @@ -74,7 +74,8 @@ object FastCsv {
// 3. count columns-per-row tallies using various delimiters
// 4. the tally with the most consistency is the "winner"
(commas, tabs, pipes, semis) match {
case (cms, tbs, pps, sms) if cms > tbs && cms >= pps && cms >= sms => ","
// in case of a tie between commas and tabs, commas win (TODO: configurable)
case (cms, tbs, pps, sms) if cms >= tbs && cms >= pps && cms >= sms => ","
case (cms, tbs, pps, sms) if tbs >= cms && tbs >= pps && tbs >= sms => "\t"
case (cms, tbs, pps, sms) if pps > cms && pps > tbs && pps > sms => "|"
case (cms, tbs, pps, sms) if sms > cms && sms > tbs && sms > pps => ";"
Expand Down
2 changes: 2 additions & 0 deletions tabTest.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1st 2nd 3rd
A B C
Loading

0 comments on commit 40102dc

Please sign in to comment.