GithubHelp home page GithubHelp logo

weso / utils Goto Github PK

View Code? Open in Web Editor NEW
2.0 7.0 6.0 2.01 MB

Common Scala utilities used by several weso projects

Home Page: https://www.weso.es/utils/

License: MIT License

Scala 2.40% JavaScript 2.23% CSS 1.98% HTML 93.39%
scala utilities scala-utilities scala-cats cats

utils's Introduction

Utils

Scala utilities

Build Status codecov Maven Central Codacy Badge

Introduction

This project contains some common utilities in Scala.

Installation and compilation

The project uses sbt for compilation as well as Java 1.8.

  • sbt test compiles and runs the tests

Author & contributors

Contributors:

Adopters

  • RDFShape: An online demo powered by this library.
  • Wikishape: An online demo powered by this library for Wikidata.

Contribution

Contributions are greatly appreciated. Please fork this repository and open a pull request to add more features or submit issues

Publishing to OSS-Sonatype

This project uses the sbt ci release plugin for publishing to OSS Sonatype.

SNAPSHOT Releases

Open a PR and merge it to watch the CI release a -SNAPSHOT version

Full Library Releases
  1. Increment the version number in version.sbt to the desired release version number.
  2. Commit and push this change with a message like "blah blah version 0.x.x".
  3. Push a tag and watch the CI do a regular release
  4. git tag -a v0.1.0 -m "v0.1.0"
  5. git push origin v0.1.0 Note that the tag version MUST start with v.

utils's People

Contributors

berezovskyi avatar labra avatar markiantorno avatar scala-steward avatar thewillyhuman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

utils's Issues

Remove dependency on Xerces

Hello,

Dependency on Xerces in Shaclex prevents us from compiling under JDK 17:

[INFO] Running org.eclipse.lyo.validation.ShaclMaxExclusiveValidationTest
java.lang.IllegalAccessError: class es.weso.utils.RegEx (in unnamed module @0x1e7ba8d9) cannot access class com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression (in module java.xml) because module java.xml does not export com.sun.org.apache.xerces.internal.impl.xpath.regex to unnamed module @0x1e7ba8d9
	at es.weso.utils.RegEx.matches(RegexUtils.scala:17)
    ...

While not a blocker (we intend to stay on JDK 8 as long as possible for our users), we'd like to resolve build errors in order not to accrue tech debt. Xerces should not be included in the new projects as JAXB has almost everything you need. Moreover, I noticed you only use it for regexp processing. Is there a reason java.util.regex.Pattern cannot be used?

Best regards,
Andrew

Codecov integration not working

Since bb4d033 codecov is raising an error and not processing coverage correctly.

If we go to the coverage webpage of the project we can see that for 79bb81b the coverage was build and proccessed. But the next commit that is receives, bb4d033, was not properly processed.

This issue must be fixed prior #4.

Add repository license

This repo, from creation, remains with no Licence. Similar repos in the organization have MIT / Apache-2 license.

Meta Issue

Roadmap

The Utils repository contains several small utilities that can be used across several projects.

cross compile to scala 3 - dotty

Check which modules can be cross compiled to scala 3.

Libraries that seem to fail:

  • circe
  • fs2
  • pprint

Libraries that may be removed if they are not needed

  • scalatest
  • scalactic
  • scala-library
  • scala-collection-compat
  • diffson-circe

Towards removing this repo

I wonder if this repo is really necessary. At the end, the repo is mostly a "catch-all" repo which contains different utilities for different purposes.

I think this is really an anti-pattern and will try to split the module into other modules/components which have a more clear name and goal.

In this issue we will keep track of the roadmap.

  • collectioncompat: will contain the es.weso.internal.utils.CollectionCompat object
  • typing: Contains a generic Typing type class, it can be extracted to its own repo
  • validating: contains a generic Checker trait that has been implemented in Cats. It was originally implemented using the Eff library. We will remove this module and create a new checker repo.
  • utilsTest: this module includes JsonMatchers which are no longer used. We may remove the whole module.
  • testSuite: this module could be extracted as a single repo

The utils folder contains the following packages:

  • json: contains several utilities to work with Json entities in Scala like DecoderUtils, JsonCompare, JsonTest and JsonTwirl. We may just create a JsonWeso repo for those utilities
  • EitherUtils contains two helper methods to work with Either values, sequence and takeSingle. I am not even sure if we use them anymore.
  • FileUtils contains some helper methods to work with files: getContents, getFileFromFolderWithExt, writeFile, formatLines, etc.
  • ...

Increase coverage to 90%

At this moment the coverage is 33% because most of the code was tested as part of other libraries from which it has been separated. Add more tests to increase coverage.

Little explanation for function fmt at Document

Hi, could you please provide me some information about what this function functionality is ?

def fmt(k: Int, state: List[FmtState]): Unit = state match {
case List() => ()
case (_, _, DocNil) :: z =>
fmt(k, z)
case (i, b, DocCons(h, t)) :: z =>
fmt(k, (i, b, h) :: (i, b, t) :: z)
case (i, _, DocText(t)) :: z =>
writer write t
fmt(k + t.length(), z)
case (i, b, DocNest(ii, d)) :: z =>
fmt(k, (i + ii, b, d) :: z)
case (i, true, DocBreak) :: z =>
writer write "\n"
spaces(i)
fmt(i, z)
case (i, false, DocBreak) :: z =>
writer write " "
fmt(k + 1, z)
case (i, b, DocGroup(d)) :: z =>
val fitsFlat = fits(width - k, (i, false, d) :: z)
fmt(k, (i, !fitsFlat, d) :: z)
case _ =>
()
}
fmt(0, (0, false, DocGroup(this)) :: Nil)
}
}

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.